本文介绍了$文件"如何从&QUOT获得附加价值;项目?使用C#(的Lotus Notes)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图访问附件名称形成$文件(Lotus Notes)中。

I am trying to access Attachment names form "$File" (Lotus Notes).

 NotesView inbox = _serverDatabase.GetView("($Inbox)");
 NotesDocument docInbox = inbox.GetFirstDocument(); 

 NotesItem file = docInbox.GetFirstItem("$File");

 String fileType = file.type.ToString(); 



(获得的fileType价值附件包含邮件附件)

( getting fileType value "ATTACHMENT" for mail containing attachments)

我没有收到中给出的解决方案:

I am not getting solution given in:

我得到的解决方案为:

object[] items = (object[])docInbox.Items; 

foreach (NotesItem nItem in items)

{

  if (nItem.Name == "$FILE")
   {

     NotesItem file = docInbox.GetFirstItem("$File");   

     string fileName = ((object[])nItem.Values) [0].ToString();

     NotesEmbeddedObject attachfile = (NotesEmbeddedObject)docInbox.GetAttachment(fileName);

     if (attachfile != null)
      {
        attachfile.ExtractFile("C:\\test\\" + fileName);
      }
 } 



但在这里,我只得到第一个附件价值。
谁能帮我出这个

But here I am getting only first attachment value.Can anyone help me out in this?

推荐答案

尝试是这样的:

    NotesView inbox = _serverDatabase.GetView("($Inbox)"); 
    NotesDocument docInbox = inbox.GetFirstDocument();  
    if(docInbox.HasEmbedded )	{
	   foreach (NotesEmbeddedObject o in docInbox.EmbeddedObjects) {
    	   if ( o.Type == 1454 ) {
    		o.ExtractFile( "c:\samples\" & o.Source )    
	}
   }
}

下面是到Lotus Notes Designer帮助的链接 - 真的好,你可以搜索类等,以找出你有哪些选择

Here is a link to Lotus Notes Designer Help - Really good as you can search for Classes etc to find out what options you have.

http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=/com.ibm.help.domino.designer85.doc /DOC/H%5FWHAT%5FS%5FNEW%5FIN%5FRNEXT%5FCHAP.html

显示你所有的方法和各种类的属性。

Show you all the methods and properties of various class.


喜Preeti,

从另一个代码示例确定要返回数组:

OK from the other code sample you are returning an array:

string fileName = ((object[])nItem.Values) [0].ToString();



然而,你只能选择第一个值,你需要通过收集递归。

Yet you are only selecting the first value, you need to recurse through the collection.

尝试这样的事情。

foreach (object attachment in (object[])nItem.Values)
        {
            NotesEmbeddedObject attachfile = (NotesEmbeddedObject)docInbox.GetAttachment(attachment.ToString());

            if (attachfile != null)
            {
                attachfile.ExtractFile("C:\\test\\" + attachment.ToString());
            }

        }



约什 -

Josh

这篇关于$文件"如何从&QUOT获得附加价值;项目?使用C#(的Lotus Notes)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 19:56