// Token: 0x0600191B RID: 6427 RVA: 0x000921A0 File Offset: 0x000903A0
        private Folder GetFolderFromModule(string module)
        {
            StoreObjectId        storeObjectId = null;
            OwaStoreObjectIdType objectIdType  = OwaStoreObjectIdType.MailBoxObject;

            if (string.Equals(module, "inbox", StringComparison.OrdinalIgnoreCase))
            {
                storeObjectId = this.userContext.TryGetMyDefaultFolderId(DefaultFolderType.Inbox);
            }
            else if (string.Equals(module, "calendar", StringComparison.OrdinalIgnoreCase))
            {
                storeObjectId = this.userContext.TryGetMyDefaultFolderId(DefaultFolderType.Calendar);
            }
            else if (string.Equals(module, "contacts", StringComparison.OrdinalIgnoreCase))
            {
                storeObjectId = this.userContext.TryGetMyDefaultFolderId(DefaultFolderType.Contacts);
            }
            else if (string.Equals(module, "tasks", StringComparison.OrdinalIgnoreCase))
            {
                storeObjectId = this.userContext.TryGetMyDefaultFolderId(DefaultFolderType.Tasks);
            }
            else if (string.Compare(module, "publicfolders", StringComparison.OrdinalIgnoreCase) == 0)
            {
                storeObjectId = this.userContext.PublicFolderRootId;
                objectIdType  = OwaStoreObjectIdType.PublicStoreFolder;
            }
            if (storeObjectId != null)
            {
                return(this.GetFolderFromId(OwaStoreObjectId.CreateFromFolderId(storeObjectId, objectIdType)));
            }
            return(null);
        }
Esempio n. 2
0
 internal static OwaStoreObjectId CreateFromOtherUserMailboxFolderId(StoreObjectId otherMailboxFolderStoreObjectId, string legacyDN)
 {
     if (otherMailboxFolderStoreObjectId == null)
     {
         throw new ArgumentNullException("otherMailboxFolderStoreObjectId");
     }
     return(OwaStoreObjectId.CreateFromFolderId(otherMailboxFolderStoreObjectId, OwaStoreObjectIdType.OtherUserMailboxObject, legacyDN));
 }
Esempio n. 3
0
 internal static OwaStoreObjectId CreateFromMailboxFolderId(StoreObjectId mailboxFolderStoreObjectId)
 {
     if (mailboxFolderStoreObjectId == null)
     {
         throw new ArgumentNullException("mailboxFolderStoreObjectId");
     }
     return(OwaStoreObjectId.CreateFromFolderId(mailboxFolderStoreObjectId, OwaStoreObjectIdType.MailBoxObject));
 }
Esempio n. 4
0
 internal static OwaStoreObjectId CreateFromPublicFolderId(StoreObjectId publicStoreFolderId)
 {
     if (publicStoreFolderId == null)
     {
         throw new ArgumentNullException("publicStoreFolderId");
     }
     return(OwaStoreObjectId.CreateFromFolderId(publicStoreFolderId, OwaStoreObjectIdType.PublicStoreFolder));
 }
Esempio n. 5
0
 internal static OwaStoreObjectId CreateFromArchiveMailboxFolderId(StoreObjectId archiveMailboxFolderStoreObjectId, string legacyDN)
 {
     if (archiveMailboxFolderStoreObjectId == null)
     {
         throw new ArgumentNullException("archiveMailboxFolderStoreObjectId");
     }
     if (string.IsNullOrEmpty(legacyDN))
     {
         throw new ArgumentNullException("legacyDN");
     }
     return(OwaStoreObjectId.CreateFromFolderId(archiveMailboxFolderStoreObjectId, OwaStoreObjectIdType.ArchiveMailboxObject, legacyDN));
 }
        // Token: 0x0600191D RID: 6429 RVA: 0x000922A4 File Offset: 0x000904A4
        private Folder GetFolderFromPath(string path, bool isPublicFolder)
        {
            string[] array = path.Split(new char[]
            {
                '/',
                '\\'
            }, StringSplitOptions.RemoveEmptyEntries);
            CultureInfo          userCulture   = Culture.GetUserCulture();
            StoreObjectId        storeObjectId = null;
            StoreSession         storeSession  = null;
            OwaStoreObjectIdType objectIdType  = OwaStoreObjectIdType.MailBoxObject;

            try
            {
                if (isPublicFolder)
                {
                    storeSession  = PublicFolderSession.OpenAsAdmin(this.userContext.ExchangePrincipal.MailboxInfo.OrganizationId, this.userContext.ExchangePrincipal, Guid.Empty, null, userCulture, "Client=OWA;Action=WebPart + Admin + GetFolderFromPath", null);
                    storeObjectId = this.userContext.PublicFolderRootId;
                    objectIdType  = OwaStoreObjectIdType.PublicStoreFolder;
                }
                else
                {
                    storeSession = MailboxSession.OpenAsAdmin(this.owaContext.ExchangePrincipal, userCulture, "Client=OWA;Action=WebPart + Admin + GetFolderFromPath");
                    GccUtils.SetStoreSessionClientIPEndpointsFromHttpRequest(storeSession, this.owaContext.HttpContext.Request);
                    storeObjectId = this.userContext.GetRootFolderId(this.userContext.MailboxSession);
                }
                for (int i = 0; i < array.Length; i++)
                {
                    object[][] folderIdByDisplayName = this.GetFolderIdByDisplayName(array[i], storeObjectId, storeSession);
                    if (folderIdByDisplayName == null || folderIdByDisplayName.Length == 0)
                    {
                        return(null);
                    }
                    storeObjectId = ((VersionedId)folderIdByDisplayName[0][0]).ObjectId;
                }
            }
            finally
            {
                if (storeSession != null)
                {
                    storeSession.Dispose();
                    storeSession = null;
                }
            }
            if (storeObjectId == null)
            {
                return(null);
            }
            return(this.GetFolderFromId(OwaStoreObjectId.CreateFromFolderId(storeObjectId, objectIdType)));
        }
        // Token: 0x0600191A RID: 6426 RVA: 0x00092150 File Offset: 0x00090350
        private OwaStoreObjectId GetFolderId(string folderId, bool isPublicFolder)
        {
            OwaStoreObjectId result = null;

            try
            {
                StoreObjectId folderStoreObjectId = Utilities.CreateStoreObjectId(folderId);
                result = OwaStoreObjectId.CreateFromFolderId(folderStoreObjectId, isPublicFolder ? OwaStoreObjectIdType.PublicStoreFolder : OwaStoreObjectIdType.MailBoxObject);
            }
            catch (OwaInvalidIdFormatException)
            {
                ExTraceGlobals.WebPartRequestTracer.TraceDebug <string>(0L, "Web part request invalid store object id: {0}", folderId);
            }
            return(result);
        }
Esempio n. 8
0
        public static OwaStoreObjectId CreateFromStoreObject(StoreObject storeObject)
        {
            if (storeObject == null)
            {
                throw new ArgumentNullException("storeObject");
            }
            if (storeObject.Id == null)
            {
                throw new ArgumentException("storeObject.Id must not be null");
            }
            OwaStoreObjectIdType owaStoreObjectIdType = OwaStoreObjectIdType.MailBoxObject;
            string legacyDN = null;

            if (Utilities.IsOtherMailbox(storeObject))
            {
                owaStoreObjectIdType = OwaStoreObjectIdType.OtherUserMailboxObject;
                legacyDN             = Utilities.GetMailboxSessionLegacyDN(storeObject);
            }
            else if (Utilities.IsInArchiveMailbox(storeObject))
            {
                owaStoreObjectIdType = OwaStoreObjectIdType.ArchiveMailboxObject;
                legacyDN             = Utilities.GetMailboxSessionLegacyDN(storeObject);
            }
            if (storeObject is Item)
            {
                if (Utilities.IsPublic(storeObject))
                {
                    owaStoreObjectIdType = OwaStoreObjectIdType.PublicStoreItem;
                }
                return(OwaStoreObjectId.CreateFromItemId(storeObject.Id.ObjectId, (owaStoreObjectIdType == OwaStoreObjectIdType.OtherUserMailboxObject) ? null : storeObject.ParentId, owaStoreObjectIdType, legacyDN));
            }
            if (storeObject is Folder)
            {
                if (Utilities.IsPublic(storeObject))
                {
                    owaStoreObjectIdType = OwaStoreObjectIdType.PublicStoreFolder;
                }
                return(OwaStoreObjectId.CreateFromFolderId(storeObject.Id.ObjectId, owaStoreObjectIdType, legacyDN));
            }
            string message = string.Format(CultureInfo.InvariantCulture, "OwaStoreObjectId.CreateOwaStoreObjectId(StoreObject) only support item or folder as input, but the input is an {0}", new object[]
            {
                storeObject.GetType().ToString()
            });

            throw new ArgumentOutOfRangeException("storeObject", message);
        }
Esempio n. 9
0
        public static Item CreatePostReplyItem(BodyFormat bodyFormat, PostItem item, UserContext userContext, StoreObjectId parentFolderId)
        {
            PostItem postItem = null;
            bool     flag     = true;

            try
            {
                string bodyPrefix = ReplyForwardUtilities.CreateReplyForwardHeader(bodyFormat, item, userContext, parentFolderId);
                string legacyDN   = null;
                OwaStoreObjectIdType owaStoreObjectIdType = Utilities.GetOwaStoreObjectIdType(userContext, item);
                if (owaStoreObjectIdType == OwaStoreObjectIdType.OtherUserMailboxObject)
                {
                    legacyDN = Utilities.GetMailboxSessionLegacyDN(item);
                }
                OwaStoreObjectId destinationFolderId        = OwaStoreObjectId.CreateFromFolderId(parentFolderId, owaStoreObjectIdType, legacyDN);
                OwaStoreObjectId scratchPadForImplicitDraft = Utilities.GetScratchPadForImplicitDraft(StoreObjectType.Post, destinationFolderId);
                try
                {
                    ReplyForwardConfiguration replyForwardConfiguration = new ReplyForwardConfiguration(bodyFormat);
                    replyForwardConfiguration.ConversionOptionsForSmime = Utilities.CreateInboundConversionOptions(userContext);
                    replyForwardConfiguration.AddBodyPrefix(bodyPrefix);
                    postItem = item.ReplyToFolder(scratchPadForImplicitDraft.GetSession(userContext), scratchPadForImplicitDraft.StoreObjectId, replyForwardConfiguration);
                }
                catch (StoragePermanentException ex)
                {
                    if (ex.InnerException is MapiExceptionNoCreateRight)
                    {
                        throw new OwaAccessDeniedException(LocalizedStrings.GetNonEncoded(995407892), ex);
                    }
                    throw ex;
                }
                ReplyForwardUtilities.CopyMessageClassificationProperties(item, postItem, userContext);
                Utilities.SetPostSender(postItem, userContext, Utilities.IsPublic(item));
                postItem.ConversationTopic = item.ConversationTopic;
                flag = false;
            }
            finally
            {
                if (flag && postItem != null)
                {
                    postItem.Dispose();
                    postItem = null;
                }
            }
            return(postItem);
        }
Esempio n. 10
0
        // Token: 0x06000F5C RID: 3932 RVA: 0x0005F528 File Offset: 0x0005D728
        public Item BindItem(StoreObjectId itemId, bool isPublic, StoreObjectId folderId)
        {
            OwaStoreObjectId owaStoreObjectId = OwaStoreObjectId.CreateFromItemId(itemId, OwaStoreObjectId.CreateFromFolderId(folderId, isPublic ? OwaStoreObjectIdType.PublicStoreFolder : OwaStoreObjectIdType.MailBoxObject));

            try
            {
                return(Utilities.GetItem <Item>(this.userContext, owaStoreObjectId, new PropertyDefinition[0]));
            }
            catch (StoragePermanentException)
            {
            }
            catch (StorageTransientException)
            {
            }
            catch (OwaPermanentException)
            {
            }
            catch (OwaTransientException)
            {
            }
            return(null);
        }