public void SendMail() { try { NotesSession ns = new NotesSessionClass(); ns.Initialize(pwd); NotesDatabase ndb = ns.GetDatabase(serverName, nsfFile, false); NotesDocument doc = ndb.CreateDocument(); doc.ReplaceItemValue("Form", "Memo"); string[] sendtoString = mailTo.ToArray(); doc.ReplaceItemValue("SendTo", sendtoString); doc.ReplaceItemValue("Subject", subject); NotesRichTextItem rt = doc.CreateRichTextItem("Body"); rt.AppendText(body); if ((attFileName != null) && (attFileName.Count > 0)) { NotesRichTextItem item = doc.CreateRichTextItem("attachment"); foreach (string att in attFileName) { item.EmbedObject(EMBED_TYPE.EMBED_ATTACHMENT, "", att, "attachment"); } } object obj = doc.GetItemValue("SendTo"); doc.Send(false, ref obj); } catch (Exception ex) { throw ex; } }
public NotesUtils(NotesSessionClass pNotesSessionClass, string strDomain, string strDataBase) { this._strDomain = strDomain; this._strDataBase = strDataBase; this._strUserName = String.Empty; this.strMessage = String.Empty; this.pInfoList = new ArrayList(); this.pNotesSession = pNotesSessionClass; }
/// <summary> /// /// </summary> /// <returns></returns> public XmlDocument GenerateLotusXML() { Domino.ISession session = new NotesSessionClass(); //session.Initialize("Ker@l@123"); session.Initialize(""); //Domino.NotesDatabase database = session.GetDatabase("", txtLotusFile.Text.Trim(), false); //string strLotusdbName = GetNSFdbName(); Domino.NotesDatabase database = session.GetDatabase("", txtLotusFile.Text.Trim(), false); Domino.NotesNoteCollection noteCollecton = database.CreateNoteCollection(true); noteCollecton.SelectAllAdminNotes(true); noteCollecton.SelectAllCodeElements(true); noteCollecton.SelectAllDataNotes(true); noteCollecton.SelectAllDesignElements(true); noteCollecton.SelectAllFormatElements(true); noteCollecton.SelectAllIndexElements(true); noteCollecton.SelectForms = true; noteCollecton.SinceTime = true; noteCollecton.BuildCollection(); Domino.NotesDXLExporter exporter = (Domino.NotesDXLExporter)session.CreateDXLExporter(); string strNsfXML = exporter.Export(noteCollecton); // removes the <!DOCTYPE database SYSTEM 'xmlschemas/domino_6_5_4.dtd'> string strDocrmv = strNsfXML.Replace("<!DOCTYPE database SYSTEM 'xmlschemas/domino_6_5_4.dtd'>", ""); // removes the xmlns='http://www.lotus.com/dxl' strDocrmv = strDocrmv.Replace("xmlns='http://www.lotus.com/dxl'", ""); XmlDocument xmlLotusDoc = new XmlDocument(); xmlLotusDoc.LoadXml(strDocrmv); return(xmlLotusDoc); }
public void Pub() { try { NotesSession ns = new NotesSessionClass(); ns.Initialize(pwd); NotesDatabase ndb = ns.GetDatabase(serverName, nsfFile, false); NotesDocument doc = ndb.CreateDocument(); doc.ReplaceItemValue("Form", "中央气象台产品记录"); doc.ReplaceItemValue("dbname_11", "juece.nsf"); doc.ReplaceItemValue("dbname_12", "juece.nsf"); doc.ReplaceItemValue("dbname_13", "juece.nsf"); doc.ReplaceItemValue("dbname_21", "juece.nsf"); doc.ReplaceItemValue("dbname_22", "juece.nsf"); doc.ReplaceItemValue("dbname_222", "juece.nsf"); doc.ReplaceItemValue("dbname_23", "juece.nsf"); doc.ReplaceItemValue("dbname_24", "juece.nsf"); doc.ReplaceItemValue("dbname_30", "juece.nsf"); doc.ReplaceItemValue("doctype", "OCX"); doc.ReplaceItemValue("Encrypt", "0"); doc.ReplaceItemValue("img", ""); doc.ReplaceItemValue("issuetime", this.dateNum); doc.ReplaceItemValue("SendTo", "CMA决策"); doc.ReplaceItemValue("SendTobyHub", "各省气象信息共享数据库"); doc.ReplaceItemValue("sendOk", "0"); doc.ReplaceItemValue("role", "周军"); doc.ReplaceItemValue("role_1", "短期科"); doc.ReplaceItemValue("标题域", this.Title); doc.ReplaceItemValue("标题域_1", this.Title); doc.ReplaceItemValue("部委", "0"); doc.ReplaceItemValue("草稿", "0"); doc.ReplaceItemValue("产品", "天气预报"); doc.ReplaceItemValue("产品_1", "天气预报"); doc.ReplaceItemValue("发布单位", "国家气象中心"); doc.ReplaceItemValue("发布单位_1", "中央气象台"); doc.ReplaceItemValue("发布单位_1_1", "中央气象台"); doc.ReplaceItemValue("发布单位_2", "国家气象中心"); doc.ReplaceItemValue("发布单位_e", "qxt"); doc.ReplaceItemValue("发布时间", this.dateNum); doc.ReplaceItemValue("发布时间_1", this.datePy); doc.ReplaceItemValue("发布时间_2", this.dateNum); //doc.ReplaceItemValue("内容", this.Content); doc.ReplaceItemValue("日期1", this.dateNum); doc.ReplaceItemValue("状态", "1"); if ((attFileName != null) && (attFileName.Count > 0)) { NotesRichTextItem item = doc.CreateRichTextItem("attachment"); foreach (string att in attFileName) { item.EmbedObject(EMBED_TYPE.EMBED_ATTACHMENT, "", att, "attachment"); doc.ReplaceItemValue("fname", System.IO.Path.GetFileName(att)); } } doc.ComputeWithForm(true, false); object obj = doc.GetItemValue("SendTo"); doc.Send(false, ref obj); } catch (Exception ex) { throw ex; } }