public bool CompareEntryIDs(EntryID entryid1, EntryID entryid2) { SBinary sb1 = SBinary.SBinaryCreate(entryid1.AsByteArray); SBinary sb2 = SBinary.SBinaryCreate(entryid2.AsByteArray); bool result; session_.CompareEntryIDs(sb1.cb, sb1.lpb, sb2.cb, sb2.lpb, 0, out result); SBinary.SBinaryRelease(ref sb1); SBinary.SBinaryRelease(ref sb2); return(result); }
/// <summary> /// Opens a message store. /// </summary> /// <param name="storeName">store name</param> /// <returns>true, if the message store was successfully opened; otherwise, failed.</returns> public bool OpenMessageStore(string storeName) { bool bResult = false; try { if (Content != null) { Content.SeekRow(BookMark.BEGINNING, 0); if (Content.SetColumns(new PropTags[] { PropTags.PR_DISPLAY_NAME, PropTags.PR_ENTRYID, PropTags.PR_DEFAULT_STORE })) { SRow[] sRows; while (Content.QueryRows(1, out sRows)) { if (sRows.Length != 1) { break; } if (string.IsNullOrEmpty(storeName)) { if (sRows[0].propVals[2].AsBool) { bResult = true; } } else if (sRows[0].propVals[0].AsString.IndexOf(storeName) > -1) { bResult = true; } if (bResult) { break; } } if (bResult) { if (CurrentStore != null) { CurrentStore.Dispose(); CurrentStore = null; } SBinary entryId = SBinary.SBinaryCreate(sRows[0].propVals[1].AsBinary); storeName = sRows[0].propVals[0].AsString; IntPtr pStore = IntPtr.Zero; if (session_.OpenMsgStore(0, entryId.cb, entryId.lpb, IntPtr.Zero, (uint)MAPIFlag.BEST_ACCESS, out pStore) == HRESULT.S_OK) { if (pStore != IntPtr.Zero) { IMsgStore msgStore = Marshal.GetObjectForIUnknown(pStore) as IMsgStore; CurrentStore = new MessageStore(this, msgStore, new EntryID(entryId.AsBytes), storeName); } } SBinary.SBinaryRelease(ref entryId); } } } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } return(bResult); }