public static OwaStoreObjectId CreateFromStoreObjectId(StoreObjectId storeObjectId, OwaStoreObjectId relatedStoreObjectId) { if (storeObjectId == null) { throw new ArgumentNullException("storeObjectId"); } StoreObjectId storeObjectId2 = null; OwaStoreObjectIdType owaStoreObjectIdType = OwaStoreObjectIdType.MailBoxObject; if (IdConverter.IsFromPublicStore(storeObjectId)) { if (IdConverter.IsMessageId(storeObjectId)) { owaStoreObjectIdType = OwaStoreObjectIdType.PublicStoreItem; storeObjectId2 = IdConverter.GetParentIdFromMessageId(storeObjectId); } else { owaStoreObjectIdType = OwaStoreObjectIdType.PublicStoreFolder; } } else if (relatedStoreObjectId != null) { if (!relatedStoreObjectId.IsConversationId) { owaStoreObjectIdType = relatedStoreObjectId.OwaStoreObjectIdType; } else if (relatedStoreObjectId.OwaStoreObjectIdType == OwaStoreObjectIdType.ArchiveConversation) { owaStoreObjectIdType = OwaStoreObjectIdType.ArchiveMailboxObject; } } return(new OwaStoreObjectId(owaStoreObjectIdType, storeObjectId, storeObjectId2, (relatedStoreObjectId == null) ? null : relatedStoreObjectId.MailboxOwnerLegacyDN)); }