Home
TeamSite
ImportCmd - Context item for unique message id ?
mawny
Hi
Im using the importcmd in my c# code to file emails .
Is there a context item that will allow me to set the unique message id field ? ( in the same manner i set all the other fields. - see code snippet :-
or will i have to wait until the document object is imported and set the profile attribute id ( e.g target.SetAttributeByID(imProfileAttributeID.imProfileMessageUniqueID);
I understand the message id holds the mapi property PR_INTERNET_MESSAGE_ID
...
context.Add("IManExt.Import.DocDescription", _mailItem.ConversationTopic + " (" + _mailItem.SenderName + ") ");
///custom 13 and custom 14 hold fromand to info
context.Add("IManExt.Import.Custom13", _mailItem.SenderName);
context.Add("IManExt.Import.Custom14", _mailItem.To);
//"Cc", and "Bcc" are held in custom15 and 16
context.Add("IManExt.Import.Custom15", _mailItem.CC);
context.Add("IManExt.Import.Custom16", _mailItem.BCC);
//custom 21 and custom 22 for send and recieved date respectively
context.Add("IManExt.Import.Custom21", _mailItem.SentOn);
context.Add("IManExt.Import.Custom22", _mailItem.ReceivedTime);
...
Thanks
Andy
Find more posts tagged with
Comments
KrishnaMohan
Hi
As per my knowledge you need to set MsgId after importing only (not sure). You need to use MAPI function, but you need to take care that there is no email with that MsgId in WorkSite as WorkSite API will not through any error when duplication occurs.
Thanks
Krish
KrishnaMohan
Hi
You can find duplicate emails by using following code
IManDocument doc = base1.GetDocument(178800,1);
MessageBox.Show(doc.Number.ToString());
IManFolders docFolders = doc.Folders;
foreach (IManFolder docFolder in docFolders)
{
MessageBox.Show("FolderName:" + docFolder.Workspace.Name);
IManProfileSearchParameters search = session.DMS.CreateProfileSearchParameters();
search.Add(imProfileAttributeID.imProfileMessageUniqueID, "DEBD49681E7DFC4EA82C35103F16037404772428@BP1XEUEX017-C.bp1.ad.bp.com");
search.Add(imProfileAttributeID.imProfileContainerID, docFolder.Workspace.FolderID.ToString());
//search.Add(imProfileAttributeID.imProfileMessageUniqueID, "4BFE17EA594BB84C80CEE64B0C84BFD506D9D2CCAE@HSTMBX003.corp.satyam.ad");
IManContents Results = (IManContents)session.SearchDocuments(strings, search, true);
int docnum1 = doc.Number;
if (Results != null)
{
IManDocument searchDoc = null;
for (int i = Results.Count; i > 0; i--)
{
searchDoc =(IManDocument)Results.ItemByIndex(i);
MessageBox.Show("Document number:" + searchDoc.Number.ToString());
if (searchDoc.Number < docnum1)
{
docnum1 = searchDoc.Number;
}
}
if (searchDoc != null && docnum1 != doc.Number)
{
foreach (IManFolder folder in doc.Folders)
{
//________________________________________________________________________________________________
if (doc.RelatedDocuments.Count!=0)
{
IManRelatedDocuments relDocs= doc.RelatedDocuments;
foreach (IManDocument relDoc in relDocs)
{
searchDoc.RelatedDocuments.AddRelation(relDoc.Number, relDoc.Comment);
searchDoc.Update();
}
}
//_____________________________________________________________________________________________________
((IManDocuments)folder.Contents).AddDocumentReference(searchDoc);
}
foreach (IManDocument docVersions in doc.Versions)
{
base1.DeleteDocument(docVersions.Number, docVersions.Version);
}
}
else
{
doc.SetAttributeByID(imProfileAttributeID.imProfileMessageUniqueID, "DEBD49681E7DFC4EA82C35103F16037404772428@BP1XEUEX017-C.bp1.ad.bp.com");
doc.Update();
}
}
}
Thanks
Krishna