public static OwaStoreObjectId CreateFromString(string owaStoreObjectIdString) { OwaStoreObjectIdType owaStoreObjectIdType = OwaStoreObjectIdType.MailBoxObject; if (owaStoreObjectIdString.StartsWith("PSF.", StringComparison.Ordinal)) { owaStoreObjectIdType = OwaStoreObjectIdType.PublicStoreFolder; } else if (owaStoreObjectIdString.StartsWith("PSI.", StringComparison.Ordinal)) { owaStoreObjectIdType = OwaStoreObjectIdType.PublicStoreItem; } else if (owaStoreObjectIdString.StartsWith("OUM.", StringComparison.Ordinal)) { owaStoreObjectIdType = OwaStoreObjectIdType.OtherUserMailboxObject; } else if (owaStoreObjectIdString.StartsWith("CID.", StringComparison.Ordinal)) { owaStoreObjectIdType = OwaStoreObjectIdType.Conversation; } else if (owaStoreObjectIdString.StartsWith("AMB.", StringComparison.Ordinal)) { owaStoreObjectIdType = OwaStoreObjectIdType.ArchiveMailboxObject; } else if (owaStoreObjectIdString.StartsWith("ACI.", StringComparison.Ordinal)) { owaStoreObjectIdType = OwaStoreObjectIdType.ArchiveConversation; } else if (owaStoreObjectIdString.StartsWith("GS.", StringComparison.Ordinal)) { owaStoreObjectIdType = OwaStoreObjectIdType.GSCalendar; } StoreObjectId folderStoreObjectId = null; StoreObjectId folderStoreObjectId2 = null; string text = null; switch (owaStoreObjectIdType) { case OwaStoreObjectIdType.PublicStoreFolder: folderStoreObjectId = Utilities.CreateStoreObjectId(owaStoreObjectIdString.Substring("PSF".Length + 1)); OwaStoreObjectId.ValidateFolderId(folderStoreObjectId); break; case OwaStoreObjectIdType.PublicStoreItem: { int num = owaStoreObjectIdString.LastIndexOf(".", StringComparison.Ordinal); if (num == "PSI".Length) { throw new OwaInvalidIdFormatException(string.Format("There should be two separator \"{0}\" in the id of the public item. Invalid Id string: {1}", ".", owaStoreObjectIdString)); } folderStoreObjectId2 = Utilities.CreateStoreObjectId(owaStoreObjectIdString.Substring("PSI".Length + 1, num - "PSI".Length - 1)); folderStoreObjectId = Utilities.CreateStoreObjectId(owaStoreObjectIdString.Substring(num + 1)); OwaStoreObjectId.ValidateFolderId(folderStoreObjectId2); break; } case OwaStoreObjectIdType.Conversation: { string[] array = owaStoreObjectIdString.Split(new char[] { "."[0] }); OwaStoreObjectId owaStoreObjectId; if (array.Length == 4) { owaStoreObjectId = new OwaStoreObjectId(ConversationId.Create(array[1]), string.IsNullOrEmpty(array[2]) ? null : Utilities.CreateStoreObjectId(array[2]), string.IsNullOrEmpty(array[3]) ? null : Utilities.CreateInstanceKey(array[3])); } else if (array.Length == 3) { owaStoreObjectId = new OwaStoreObjectId(ConversationId.Create(array[1]), Utilities.CreateStoreObjectId(array[2]), null); } else { if (array.Length != 2) { throw new OwaInvalidRequestException(string.Format("There should be one or two separator \"{0}\" in the id of the conversation item", ".")); } owaStoreObjectId = new OwaStoreObjectId(ConversationId.Create(array[1]), null, null); } owaStoreObjectId.bufferedIdString = owaStoreObjectIdString; return(owaStoreObjectId); } case OwaStoreObjectIdType.OtherUserMailboxObject: { int num = owaStoreObjectIdString.LastIndexOf(".", StringComparison.Ordinal); folderStoreObjectId = OwaStoreObjectId.CreateStoreObjectIdFromString(owaStoreObjectIdString, "OUM", num); text = OwaStoreObjectId.ParseLegacyDnBase64String(owaStoreObjectIdString.Substring(num + 1)); break; } case OwaStoreObjectIdType.ArchiveMailboxObject: { int num = owaStoreObjectIdString.LastIndexOf(".", StringComparison.Ordinal); folderStoreObjectId = OwaStoreObjectId.CreateStoreObjectIdFromString(owaStoreObjectIdString, "AMB", num); text = OwaStoreObjectId.ParseLegacyDnBase64String(owaStoreObjectIdString.Substring(num + 1)); break; } case OwaStoreObjectIdType.ArchiveConversation: { string[] array = owaStoreObjectIdString.Split(new char[] { "."[0] }); OwaStoreObjectId owaStoreObjectId; if (array.Length == 5) { text = OwaStoreObjectId.ParseLegacyDnBase64String(array[3]); owaStoreObjectId = new OwaStoreObjectId(ConversationId.Create(array[1]), string.IsNullOrEmpty(array[2]) ? null : Utilities.CreateStoreObjectId(array[2]), text, string.IsNullOrEmpty(array[4]) ? null : Utilities.CreateInstanceKey(array[4])); } else if (array.Length == 4) { text = OwaStoreObjectId.ParseLegacyDnBase64String(array[3]); owaStoreObjectId = new OwaStoreObjectId(ConversationId.Create(array[1]), Utilities.CreateStoreObjectId(array[2]), text, null); } else { if (array.Length != 3) { throw new OwaInvalidRequestException(string.Format("There should be two or three separator \"{0}\" in the id of the archive conversation item", ".")); } text = OwaStoreObjectId.ParseLegacyDnBase64String(array[2]); owaStoreObjectId = new OwaStoreObjectId(ConversationId.Create(array[1]), null, text, null); } owaStoreObjectId.bufferedIdString = owaStoreObjectIdString; return(owaStoreObjectId); } case OwaStoreObjectIdType.GSCalendar: { string[] array = owaStoreObjectIdString.Split(new char[] { "."[0] }); if (array.Length != 2) { throw new OwaInvalidRequestException(string.Format("There should be two separator \"{0}\" in the id of the GS calendar item", ".")); } text = OwaStoreObjectId.ParseLegacyDnBase64String(array[1]); break; } default: return(OwaStoreObjectId.CreateFromStoreObjectId(Utilities.CreateStoreObjectId(owaStoreObjectIdString), null)); } return(new OwaStoreObjectId(owaStoreObjectIdType, folderStoreObjectId, folderStoreObjectId2, text) { bufferedIdString = owaStoreObjectIdString }); }