private static string GetFolderLegacyDistinguishedName(MapiEntryId abEntryId, MapiFolder folder) { string result; try { if (null == abEntryId) { if (folder == null) { throw new ArgumentNullException("folder"); } PropValue prop = folder.GetProp(PropTag.AddressBookEntryId); if (PropType.Error == prop.PropType) { return(null); } abEntryId = new MapiEntryId(prop.GetBytes()); } result = MapiMessageStoreSession.GetLegacyDNFromAddressBookEntryId(abEntryId); } catch (MapiPermanentException) { result = null; } catch (MapiRetryableException) { result = null; } return(result); }
internal static MapiEntryId GetEntryIdentity(MapiProp mapiObject) { MapiEntryId result; try { if (mapiObject == null) { throw new ArgumentNullException("mapiObject"); } PropValue prop = mapiObject.GetProp(PropTag.EntryId); if (PropType.Error == prop.PropType) { result = null; } else { result = new MapiEntryId(prop.GetBytes()); } } catch (MapiPermanentException) { result = null; } catch (MapiRetryableException) { result = null; } return(result); }
protected sealed override void UpdateIdentity(MapiObject.UpdateIdentityFlags flags) { MapiEntryId mapiEntryId = this.Identity.MapiEntryId; DatabaseId mailboxDatabaseId = this.Identity.MailboxDatabaseId; Guid mailboxGuid = this.Identity.MailboxGuid; string mailboxExchangeLegacyDn = this.Identity.MailboxExchangeLegacyDn; this.Identity = new MailboxId(mapiEntryId, mailboxDatabaseId, mailboxGuid, mailboxExchangeLegacyDn); }
protected sealed override void UpdateIdentity(MapiObject.UpdateIdentityFlags flags) { bool flag = MapiObject.UpdateIdentityFlags.Nop == (MapiObject.UpdateIdentityFlags.SkipIfExists & flags); MapiEntryId mapiEntryId = this.Identity.MapiEntryId; DatabaseId mailboxDatabaseId = this.Identity.MailboxDatabaseId; Guid mailboxGuid = this.Identity.MailboxGuid; string mailboxExchangeLegacyDn = this.Identity.MailboxExchangeLegacyDn; if ((MapiObject.UpdateIdentityFlags.LegacyDistinguishedName & flags) != MapiObject.UpdateIdentityFlags.Nop && (string.IsNullOrEmpty(this.Identity.MailboxExchangeLegacyDn) || flag)) { mailboxExchangeLegacyDn = (string)this[LogonStatisticsSchema.FullMailboxDirectoryName]; } this.Identity = new MailboxId(mapiEntryId, mailboxDatabaseId, mailboxGuid, mailboxExchangeLegacyDn); }
internal static string GetLegacyDNFromAddressBookEntryId(MapiEntryId abbEntryId) { string result = null; try { result = MapiStore.GetLegacyDNFromAddressBookEntryId((byte[])abbEntryId); } catch (MapiRetryableException exception) { MapiSession.ThrowWrappedException(exception, Strings.ErrorGetGetLegacyDNFromAddressBookEntryId(abbEntryId.ToString()), null, null); } catch (MapiPermanentException exception2) { MapiSession.ThrowWrappedException(exception2, Strings.ErrorGetGetLegacyDNFromAddressBookEntryId(abbEntryId.ToString()), null, null); } catch (MapiInvalidOperationException exception3) { MapiSession.ThrowWrappedException(exception3, Strings.ErrorGetGetLegacyDNFromAddressBookEntryId(abbEntryId.ToString()), null, null); } return(result); }
public static PublicFolderId Parse(string input) { if (string.IsNullOrEmpty(input)) { throw new FormatException(Strings.ExceptionFormatNotSupported); } try { return(new PublicFolderId(MapiFolderPath.Parse(input))); } catch (FormatException) { } try { return(new PublicFolderId(MapiEntryId.Parse(input))); } catch (FormatException) { } return(new PublicFolderId(input)); }
protected override void UpdateIdentity(MapiObject.UpdateIdentityFlags flags) { bool flag = MapiObject.UpdateIdentityFlags.Nop == (MapiObject.UpdateIdentityFlags.SkipIfExists & flags); MapiEntryId entryId = this.Identity.MapiEntryId; DatabaseId mailboxDatabaseId = this.Identity.MailboxDatabaseId; Guid? guid = new Guid?(this.Identity.MailboxGuid); string mailboxExchangeLegacyDn = this.Identity.MailboxExchangeLegacyDn; if ((MapiObject.UpdateIdentityFlags.EntryIdentity & flags) != MapiObject.UpdateIdentityFlags.Nop && (null == this.Identity.MapiEntryId || flag)) { entryId = (MapiEntryId)this[MapiPropertyDefinitions.EntryId]; } if ((MapiObject.UpdateIdentityFlags.MailboxGuid & flags) != MapiObject.UpdateIdentityFlags.Nop && (Guid.Empty == this.Identity.MailboxGuid || flag)) { guid = (Guid?)this[MapiPropertyDefinitions.MailboxGuid]; } if ((MapiObject.UpdateIdentityFlags.LegacyDistinguishedName & flags) != MapiObject.UpdateIdentityFlags.Nop && (string.IsNullOrEmpty(this.Identity.MailboxExchangeLegacyDn) || flag)) { mailboxExchangeLegacyDn = (string)this[MapiPropertyDefinitions.LegacyDN]; } this.Identity = new MailboxId(entryId, mailboxDatabaseId, guid ?? Guid.Empty, mailboxExchangeLegacyDn); }
internal FolderId(MessageStoreId storeId, MapiEntryId entryId, MapiFolderPath folderPath, string legacyDn) : base(entryId) { this.messageStoreId = storeId; this.mapiFolderPath = folderPath; this.legacyDistinguishedName = legacyDn; }
internal MessageId(MapiEntryId entryId) : base(entryId) { }
internal MailboxId(MapiEntryId entryId, DatabaseId mailboxDatabaseId, Guid mailboxGuid, string mailboxExchangeLegacyDn) : base(entryId) { this.mailboxDatabaseId = mailboxDatabaseId; this.mailboxGuid = mailboxGuid; this.mailboxExchangeLegacyDn = mailboxExchangeLegacyDn; }
internal DatabaseId(MapiEntryId entryId, string serverName, string dbName, Guid guid) : base(entryId) { this.serverName = serverName; this.databaseName = dbName; this.guid = guid; }
internal PublicFolderId(MapiEntryId entryId, MapiFolderPath folderPath, string legacyDn) : base(new PublicStoreId(), entryId, folderPath, legacyDn) { }
public PublicFolderId(MapiEntryId entryId) : base(new PublicStoreId(), entryId) { }
public MapiObjectId(MapiEntryId mapiEntryId) { this.mapiEntryId = mapiEntryId; }
public MailboxId(MapiEntryId entryId) : base(entryId) { }
public FolderId(MessageStoreId storeId, MapiEntryId entryId) : base(entryId) { this.messageStoreId = storeId; }
internal static MapiFolder RetrieveMapiFolder(MapiStore store, FolderId identity, ref MapiFolder parent, Folder.IdentityConstructor idCtor, out FolderId realId) { realId = null; if (store == null) { throw new ArgumentNullException("store"); } Folder.CheckRequirementsOnIdentityToContinue(identity); MapiFolder mapiFolder = null; bool flag = false; bool flag2 = false; MapiFolder result; try { byte[] array = null; MapiEntryId entryId = null; MapiFolderPath folderPath = null; string legacyDn = null; if (null == identity.MapiEntryId) { if (identity.LegacyDistinguishedName != null) { legacyDn = identity.LegacyDistinguishedName; array = store.GetFolderEntryId(identity.LegacyDistinguishedName); } } else { array = (byte[])identity.MapiEntryId; } if (array != null) { entryId = new MapiEntryId(array); mapiFolder = (MapiFolder)store.OpenEntry(array); if (parent == null) { parent = (MapiFolder)store.OpenEntry(mapiFolder.GetProp(PropTag.ParentEntryId).GetBytes()); flag = true; } } else if (null != identity.MapiFolderPath) { folderPath = identity.MapiFolderPath; if (parent == null) { mapiFolder = Folder.GetFolderByPath(store, identity.MapiFolderPath, out parent); flag = true; } else { mapiFolder = Folder.GetFolderByPath(store, parent, identity.MapiFolderPath); } } if (idCtor != null) { realId = idCtor(entryId, folderPath, legacyDn); } flag2 = true; result = mapiFolder; } finally { if (!flag2) { if (mapiFolder != null) { mapiFolder.Dispose(); mapiFolder = null; } if (flag && parent != null) { parent.Dispose(); parent = null; } } } return(result); }
public MessageStoreId(MapiEntryId entryId) : base(entryId) { }
private static MapiFolderPath GetFolderPath(MapiEntryId folderEntryId, MapiFolder mapiFolder, MapiStore mapiStore) { MapiFolderPath result; try { if (null == folderEntryId) { if (mapiFolder == null) { throw new ArgumentNullException("mapiFolder"); } PropValue prop = mapiFolder.GetProp(PropTag.EntryId); if (PropType.Error == prop.PropType) { return(null); } folderEntryId = new MapiEntryId(prop.GetBytes()); } if (mapiStore == null) { throw new ArgumentNullException("mapiStore"); } MapiEntryId operand; using (MapiFolder rootFolder = mapiStore.GetRootFolder()) { operand = new MapiEntryId(rootFolder.GetProp(PropTag.EntryId).GetBytes()); } MapiEntryId operand2 = new MapiEntryId(mapiStore.GetIpmSubtreeFolderEntryId()); MapiEntryId operand3 = new MapiEntryId(mapiStore.GetNonIpmSubtreeFolderEntryId()); MapiFolderPath mapiFolderPath = null; MapiEntryId mapiEntryId = folderEntryId; MapiEntryId mapiEntryId2 = null; string parentFolderName = null; while (!(operand2 == mapiEntryId)) { if (operand3 == mapiEntryId || operand == mapiEntryId) { mapiFolderPath = MapiFolderPath.GenerateFolderPath("NON_IPM_SUBTREE", mapiFolderPath, true); } else { using (MapiFolder mapiFolder2 = (MapiFolder)mapiStore.OpenEntry((byte[])mapiEntryId)) { PropValue[] props = mapiFolder2.GetProps(new PropTag[] { PropTag.ParentEntryId, PropTag.DisplayName }); if (PropType.Error == props[0].PropType || PropType.Error == props[1].PropType) { return(null); } mapiEntryId2 = new MapiEntryId(props[0].GetBytes()); parentFolderName = props[1].GetString(); } if (!(mapiEntryId2 == mapiEntryId)) { mapiFolderPath = MapiFolderPath.GenerateFolderPath(parentFolderName, mapiFolderPath, false); mapiEntryId = mapiEntryId2; continue; } } IL_19C: return(mapiFolderPath); } mapiFolderPath = MapiFolderPath.GenerateFolderPath("IPM_SUBTREE", mapiFolderPath, true); goto IL_19C; } catch (MapiPermanentException) { result = null; } catch (MapiRetryableException) { result = null; } return(result); }