示例#1
0
        private bool CanAddLibraryToFavorites()
        {
            UriFlags uriFlags = this.libraryType;

            switch (uriFlags)
            {
            case UriFlags.Sharepoint:
            case UriFlags.Unc:
            case UriFlags.SharepointDocumentLibrary:
            case UriFlags.UncDocumentLibrary:
                break;

            case UriFlags.Sharepoint | UriFlags.Unc:
            case UriFlags.DocumentLibrary:
                return(false);

            default:
                switch (uriFlags)
                {
                case UriFlags.SharepointFolder:
                case UriFlags.UncFolder:
                    break;

                default:
                    return(false);
                }
                break;
            }
            return(true);
        }
示例#2
0
 internal DocumentViewListToolbar(SharepointSession sharepointSession, UriFlags libraryType, bool isRootFolder) : base("divTBL")
 {
     this.sharepointSession = sharepointSession;
     this.libraryType       = libraryType;
     this.isRootFolder      = isRootFolder;
     this.contextMenu       = new DocumentBreadcrumbBarContextMenu(base.UserContext);
 }
示例#3
0
 internal DocumentViewListToolbar(IDocumentLibraryFolder libraryFolder, UriFlags libraryType, bool isRootFolder) : base("divTBL")
 {
     this.libraryFolder = libraryFolder;
     this.libraryType   = libraryType;
     this.isRootFolder  = isRootFolder;
     this.contextMenu   = new DocumentBreadcrumbBarContextMenu(base.UserContext);
 }
示例#4
0
 internal UncObjectId(Uri path, UriFlags uriFlags) : base(uriFlags)
 {
     if (!path.IsUnc)
     {
         throw new ArgumentException("path");
     }
     this.path = path;
 }
示例#5
0
        /// <summary>
        /// 创建URI并修复绝对URI
        /// </summary>
        /// <param name="url">URI字符串</param>
        /// <param name="removeFlags">删除状态,比如 UriFlags.ShouldBeCompressed | UriFlags.E_QueryNotCanonical</param>
        /// <returns>创建的URI</returns>
        public static Uri CreateAbsolute(string url, UriFlags removeFlags)
        {//#uri.m_Info.Offset.Fragment = uri.m_Info.Offset.End
            Uri uri;

            if (Uri.TryCreate(url, UriKind.Absolute, out uri) && uri.AbsoluteUri != url)
            {
                setAbsolute(uri, url, removeFlags);
            }
            return(uri);
        }
示例#6
0
        // Token: 0x06002066 RID: 8294 RVA: 0x000BB6C8 File Offset: 0x000B98C8
        protected override void RenderMenuItems(TextWriter output, UserContext userContext)
        {
            UriFlags uriFlags = this.libraryType;

            switch (uriFlags)
            {
            case UriFlags.Sharepoint:
                ArrangeByMenu.RenderMenuItem(output, -1966747349, null, ColumnId.SharepointDocumentLibraryDisplayName);
                ArrangeByMenu.RenderMenuItem(output, 873740972, null, ColumnId.SharepointDocumentLibraryDescription);
                ArrangeByMenu.RenderMenuItem(output, 1554779067, null, ColumnId.SharepointDocumentLibraryItemCount);
                ArrangeByMenu.RenderMenuItem(output, 869905365, null, ColumnId.SharepointDocumentLibraryLastModified);
                return;

            case UriFlags.Unc:
                ArrangeByMenu.RenderMenuItem(output, -1966747349, null, ColumnId.UncDocumentDisplayName);
                ArrangeByMenu.RenderMenuItem(output, 869905365, null, ColumnId.UncDocumentLastModified);
                return;

            case UriFlags.Sharepoint | UriFlags.Unc:
            case UriFlags.DocumentLibrary:
                return;

            case UriFlags.SharepointDocumentLibrary:
                goto IL_81;

            case UriFlags.UncDocumentLibrary:
                break;

            default:
                switch (uriFlags)
                {
                case UriFlags.SharepointFolder:
                    goto IL_81;

                case UriFlags.UncFolder:
                    break;

                default:
                    return;
                }
                break;
            }
            ArrangeByMenu.RenderMenuItem(output, -1966747349, null, ColumnId.UncDocumentDisplayName);
            ArrangeByMenu.RenderMenuItem(output, 869905365, null, ColumnId.UncDocumentLastModified);
            ArrangeByMenu.RenderMenuItem(output, -837446919, null, ColumnId.UncDocumentFileSize);
            return;

IL_81:
            ArrangeByMenu.RenderMenuItem(output, -1966747349, null, ColumnId.SharepointDocumentDisplayName);
            ArrangeByMenu.RenderMenuItem(output, 869905365, null, ColumnId.SharepointDocumentLastModified);
            ArrangeByMenu.RenderMenuItem(output, 1276881056, null, ColumnId.SharepointDocumentModifiedBy);
            ArrangeByMenu.RenderMenuItem(output, -580782680, null, ColumnId.SharepointDocumentCheckedOutTo);
            ArrangeByMenu.RenderMenuItem(output, -837446919, null, ColumnId.SharepointDocumentFileSize);
        }
示例#7
0
        ///////////////////////////////////////////////////////////////////////

        public static bool HasFlags(
            UriFlags flags,
            UriFlags hasFlags,
            bool all
            )
        {
            if (all)
            {
                return((flags & hasFlags) == hasFlags);
            }
            else
            {
                return((flags & hasFlags) != UriFlags.None);
            }
        }
示例#8
0
        private void RenderBreadcrumbBar()
        {
            base.Writer.Write("<td class=\"w100 lnkbr\"><img align=absmiddle height=16 width=0>&nbsp;");
            UriFlags uriFlags = this.libraryType;

            switch (uriFlags)
            {
            case UriFlags.Sharepoint:
                this.RenderSharepointSiteBreadcrumbs();
                break;

            case UriFlags.Unc:
                this.RenderUncSiteBreadcrumbs();
                break;

            case UriFlags.Sharepoint | UriFlags.Unc:
            case UriFlags.DocumentLibrary:
                break;

            case UriFlags.SharepointDocumentLibrary:
                this.RenderSharepointBreadcrumbs(this.documentLibrary.GetHierarchy());
                break;

            case UriFlags.UncDocumentLibrary:
                this.RenderUncBreadcrumbs();
                break;

            default:
                switch (uriFlags)
                {
                case UriFlags.SharepointFolder:
                    this.RenderSharepointBreadcrumbs(this.libraryFolder.GetHierarchy());
                    break;

                case UriFlags.UncFolder:
                    this.RenderUncBreadcrumbs();
                    break;
                }
                break;
            }
            this.contextMenu.Render(base.Writer);
            base.Writer.Write("</td>");
        }
示例#9
0
        private void RenderUncBreadcrumbs()
        {
            List <KeyValuePair <string, Uri> > list = (this.libraryFolder != null) ? this.libraryFolder.GetHierarchy() : this.documentLibrary.GetHierarchy();
            bool flag = false;

            UriFlags[] array = new UriFlags[]
            {
                UriFlags.Unc,
                UriFlags.UncDocumentLibrary,
                UriFlags.UncFolder
            };
            base.Writer.Write("<span dir=\"ltr\" class=\"nolnk\">\\\\</span> ");
            for (int i = 0; i < list.Count; i++)
            {
                if (flag)
                {
                    base.Writer.Write(" \\ ");
                }
                else
                {
                    flag = true;
                }
                this.RenderCrumb(list[i].Key.TrimEnd(new char[]
                {
                    '/'
                }), list[i].Value.LocalPath.TrimEnd(new char[]
                {
                    '\\'
                }), (i < array.Length) ? array[i] : UriFlags.UncFolder, false);
            }
            if (flag)
            {
                base.Writer.Write(" \\ ");
            }
            if (this.libraryFolder != null)
            {
                this.RenderCrumb(this.libraryFolder.DisplayName, new Strings.IDs?(-527057840), this.libraryFolder.Uri.ToString(), (list.Count == 2) ? UriFlags.UncDocumentLibrary : UriFlags.UncFolder, true);
                return;
            }
            this.RenderCrumb(this.documentLibrary.Title, new Strings.IDs?(477016274), this.documentLibrary.Uri.ToString(), (list.Count == 2) ? UriFlags.UncDocumentLibrary : UriFlags.UncFolder, true);
        }
示例#10
0
        private void RenderSharepointBreadcrumbs(List <KeyValuePair <string, Uri> > crumbs)
        {
            bool flag = false;

            UriFlags[] array = new UriFlags[]
            {
                UriFlags.Sharepoint,
                UriFlags.SharepointDocumentLibrary,
                UriFlags.SharepointFolder
            };
            for (int i = 0; i < crumbs.Count; i++)
            {
                if (flag)
                {
                    base.Writer.Write(" / ");
                }
                else
                {
                    flag = true;
                }
                this.RenderCrumb(crumbs[i].Key, crumbs[i].Value.AbsoluteUri, (i < array.Length) ? array[i] : UriFlags.SharepointFolder, false);
            }
            if (flag)
            {
                base.Writer.Write(" / ");
            }
            if (this.libraryFolder != null)
            {
                this.RenderCrumb(this.libraryFolder.DisplayName, new Strings.IDs?(-527057840), this.libraryFolder.Uri.ToString(), UriFlags.SharepointFolder, true);
                return;
            }
            if (this.documentLibrary != null)
            {
                this.RenderCrumb(this.documentLibrary.Title, new Strings.IDs?(477016274), this.documentLibrary.Uri.ToString(), UriFlags.SharepointDocumentLibrary, true);
            }
        }
示例#11
0
        public void SendByEmail()
        {
            ExTraceGlobals.DocumentsCallTracer.TraceDebug((long)this.GetHashCode(), "DocumentLibraryEventHandler.SendByEmail");
            MessageItem messageItem = null;

            string[] array  = (string[])base.GetParameter("uri");
            Stream   stream = null;
            bool     flag   = DocumentLibraryUtilities.IsNavigationToWSSAllowed(base.UserContext);
            bool     flag2  = DocumentLibraryUtilities.IsNavigationToUNCAllowed(base.UserContext);

            try
            {
                for (int i = 0; i < array.Length; i++)
                {
                    ClassifyResult documentLibraryObjectId = DocumentLibraryUtilities.GetDocumentLibraryObjectId(array[i], base.UserContext);
                    if (documentLibraryObjectId == null)
                    {
                        ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Could not classify link: " + array[i]);
                        throw new OwaEventHandlerException("Could not add attachment to email", LocalizedStrings.GetNonEncoded(1948229493), OwaEventHandlerErrorCode.SendByEmailError);
                    }
                    DocumentLibraryObjectId objectId = documentLibraryObjectId.ObjectId;
                    if (objectId == null)
                    {
                        ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "ObjectId could not be created from URI parameter: " + array[i]);
                        throw new OwaEventHandlerException("Could not add attachment to email", LocalizedStrings.GetNonEncoded(1948229493), OwaEventHandlerErrorCode.SendByEmailError);
                    }
                    UriFlags uriFlags = objectId.UriFlags;
                    try
                    {
                        string text;
                        switch (uriFlags)
                        {
                        case UriFlags.SharepointDocument:
                        {
                            if (!flag)
                            {
                                throw new OwaSegmentationException("Access to Sharepoint documents is disabled");
                            }
                            SharepointSession  session            = base.UserContext.LogonIdentity.CreateSharepointSession(objectId);
                            SharepointDocument sharepointDocument = SharepointDocument.Read(session, objectId);
                            stream = sharepointDocument.GetDocument();
                            text   = (string.IsNullOrEmpty(sharepointDocument.DisplayName) ? LocalizedStrings.GetNonEncoded(1797976510) : sharepointDocument.DisplayName);
                            break;
                        }

                        case UriFlags.UncDocument:
                        {
                            if (!flag2)
                            {
                                throw new OwaSegmentationException("Access to Unc documents is disabled");
                            }
                            UncSession  session2    = base.UserContext.LogonIdentity.CreateUncSession(objectId);
                            UncDocument uncDocument = UncDocument.Read(session2, objectId);
                            stream = uncDocument.GetDocument();
                            text   = Path.GetFileName(uncDocument.Uri.ToString());
                            if (!string.IsNullOrEmpty(text))
                            {
                                text = HttpUtility.UrlDecode(text);
                            }
                            break;
                        }

                        default:
                            throw new OwaNotSupportedException("Unhandled document library type");
                        }
                        if (messageItem == null)
                        {
                            messageItem = MessageItem.Create(base.UserContext.MailboxSession, base.UserContext.DraftsFolderId);
                            messageItem[ItemSchema.ConversationIndexTracking] = true;
                        }
                        int num;
                        AttachmentAddResult attachmentAddResult = AttachmentUtility.AddAttachmentFromStream(messageItem, text, null, stream, base.UserContext, out num);
                        if (Globals.ArePerfCountersEnabled)
                        {
                            if (uriFlags == UriFlags.UncDocument)
                            {
                                OwaSingleCounters.UncRequests.Increment();
                                OwaSingleCounters.UncBytes.IncrementBy((long)num);
                            }
                            else
                            {
                                OwaSingleCounters.WssRequests.Increment();
                                OwaSingleCounters.WssBytes.IncrementBy((long)num);
                            }
                        }
                        if (attachmentAddResult.ResultCode != AttachmentAddResultCode.NoError)
                        {
                            throw new OwaEventHandlerException("Could not add attachment to email. " + attachmentAddResult.Message, LocalizedStrings.GetNonEncoded(1948229493), OwaEventHandlerErrorCode.SendByEmailError);
                        }
                    }
                    finally
                    {
                        if (stream != null)
                        {
                            stream.Close();
                            stream = null;
                        }
                    }
                }
                messageItem.Save(SaveMode.ResolveConflicts);
                messageItem.Load();
                this.Writer.Write(messageItem.Id.ObjectId.ToBase64String());
            }
            finally
            {
                if (messageItem != null)
                {
                    messageItem.Dispose();
                    messageItem = null;
                }
            }
        }
示例#12
0
        public void ClassifyLink()
        {
            ExTraceGlobals.DocumentsCallTracer.TraceDebug((long)this.GetHashCode(), "DocumentLibraryEventHandler.ClassifyLink");
            string text = (string)base.GetParameter("uri");
            Uri    uri  = Utilities.TryParseUri(text);

            if (uri == null && !text.StartsWith("\\\\", StringComparison.Ordinal))
            {
                text = "http://" + text;
                uri  = Utilities.TryParseUri(text);
            }
            if (uri == null || string.IsNullOrEmpty(uri.Scheme) || string.IsNullOrEmpty(uri.Host))
            {
                ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Cannot parse a Uri from string.");
                base.RenderPartialFailure(-2054976140, new Strings.IDs?(-381883412), ButtonDialogIcon.Warning);
                return;
            }
            if (!DocumentLibraryUtilities.IsTrustedProtocol(uri.Scheme))
            {
                ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI protocol is not http, https or file.");
                base.RenderPartialFailure(1453018462, new Strings.IDs?(-743095750), ButtonDialogIcon.Information);
                return;
            }
            if (!DocumentLibraryUtilities.IsInternalUri(uri.Host, base.UserContext))
            {
                ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Not an internal URI");
                base.RenderPartialFailure(-1721073157, new Strings.IDs?(1325518514), ButtonDialogIcon.Warning);
                return;
            }
            if (DocumentLibraryUtilities.IsBlockedHostName(uri.Host, base.UserContext))
            {
                ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Host name is in the blocked list.");
                base.RenderPartialFailure(343095135, new Strings.IDs?(-777407791), ButtonDialogIcon.Warning);
                return;
            }
            ClassifyResult documentLibraryObjectId = DocumentLibraryUtilities.GetDocumentLibraryObjectId(uri, base.UserContext);

            if (documentLibraryObjectId.Error != ClassificationError.None)
            {
                if (documentLibraryObjectId.Error == ClassificationError.ConnectionFailed)
                {
                    ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Connection could not be made to server.");
                    base.RenderPartialFailure(678272416, new Strings.IDs?(-820112926), ButtonDialogIcon.Warning);
                    return;
                }
                if (documentLibraryObjectId.Error == ClassificationError.ObjectNotFound)
                {
                    ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI object not found.");
                    base.RenderPartialFailure(-54320700, new Strings.IDs?(1599334062), ButtonDialogIcon.Warning);
                    return;
                }
                if (documentLibraryObjectId.Error == ClassificationError.AccessDenied)
                {
                    ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI access is denied.");
                    if (Utilities.IsBasicAuthentication(base.OwaContext.HttpContext.Request))
                    {
                        base.RenderPartialFailure(234621291, new Strings.IDs?(-3401788), ButtonDialogIcon.Warning);
                        return;
                    }
                    base.RenderPartialFailure(1819837349, new Strings.IDs?(-3401788), ButtonDialogIcon.Warning);
                    return;
                }
                else
                {
                    if (documentLibraryObjectId.Error == ClassificationError.UriTypeNotSupported)
                    {
                        ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI is not supported.");
                        base.RenderPartialFailure(1453018462, new Strings.IDs?(-743095750), ButtonDialogIcon.Information);
                        return;
                    }
                    if (documentLibraryObjectId.Error == ClassificationError.InvalidUri)
                    {
                        ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI was Invalid.");
                        base.RenderPartialFailure(-2054976140, new Strings.IDs?(-381883412), ButtonDialogIcon.Warning);
                        return;
                    }
                    if (documentLibraryObjectId.Error == ClassificationError.ProxyError)
                    {
                        ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI was Invalid.");
                        base.RenderPartialFailure(1454208029, new Strings.IDs?(1335662059), ButtonDialogIcon.Warning);
                        return;
                    }
                    ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Other classification error.  ClassifyResult.Error: " + documentLibraryObjectId.Error.ToString());
                    base.RenderPartialFailure(-785304559, new Strings.IDs?(-86901060), ButtonDialogIcon.Warning);
                    return;
                }
            }
            else
            {
                DocumentLibraryObjectId objectId = documentLibraryObjectId.ObjectId;
                if (objectId == null)
                {
                    ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "ObjectId could not be created from Uri");
                    base.RenderPartialFailure(-2054976140, new Strings.IDs?(-381883412), ButtonDialogIcon.Warning);
                    return;
                }
                UriFlags uriFlags = objectId.UriFlags;
                bool     flag     = (uriFlags & UriFlags.Sharepoint) == UriFlags.Sharepoint;
                bool     flag2    = (uriFlags & UriFlags.Unc) == UriFlags.Unc;
                bool     flag3    = DocumentLibraryUtilities.IsNavigationToWSSAllowed(base.UserContext);
                bool     flag4    = DocumentLibraryUtilities.IsNavigationToUNCAllowed(base.UserContext);
                if (objectId.UriFlags == UriFlags.Other)
                {
                    ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Link could not be classified as Sharepoint or UNC");
                    if (flag4 && flag3)
                    {
                        base.RenderPartialFailure(1528018289, new Strings.IDs?(-743095750), ButtonDialogIcon.Information);
                        return;
                    }
                    if (flag4)
                    {
                        base.RenderPartialFailure(-1758685302, new Strings.IDs?(-743095750), ButtonDialogIcon.Information);
                        return;
                    }
                    if (flag3)
                    {
                        base.RenderPartialFailure(762710799, new Strings.IDs?(-743095750), ButtonDialogIcon.Information);
                    }
                    return;
                }
                else
                {
                    if ((flag2 && !flag4) || (flag && !flag3))
                    {
                        ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Segmentation failure. Access Denied");
                        base.RenderPartialFailure(flag2 ? 813043446 : -972777689, new Strings.IDs?(-3401788), ButtonDialogIcon.Warning);
                        return;
                    }
                    this.Writer.Write("<div id=uri>");
                    this.Writer.Write(text);
                    this.Writer.Write("</div><div id=uf>");
                    this.Writer.Write((int)uriFlags);
                    this.Writer.Write("</div><div id=oid>");
                    this.Writer.Write(objectId.ToBase64String());
                    this.Writer.Write("</div>");
                    AttachmentPolicy attachmentPolicy = base.UserContext.AttachmentPolicy;
                    this.Writer.Write("<div id=divFwr>");
                    this.Writer.Write((attachmentPolicy.ForceWebReadyDocumentViewingFirst && DocumentLibraryUtilities.IsWebReadyDocument(objectId, base.UserContext)) ? 1 : 0);
                    this.Writer.Write("</div>");
                    return;
                }
            }
        }
示例#13
0
        public void AddFavoriteLibrary()
        {
            ExTraceGlobals.DocumentsCallTracer.TraceDebug((long)this.GetHashCode(), "DocumentLibraryEventHandler.AddFavoriteLibrary");
            string[] array = (string[])base.GetParameter("uri");
            bool     flag  = false;

            this.Writer.Write("<div id=divAFavLibs>");
            for (int i = 0; i < array.Length; i++)
            {
                ClassifyResult documentLibraryObjectId = DocumentLibraryUtilities.GetDocumentLibraryObjectId(array[i], base.UserContext);
                if (documentLibraryObjectId == null)
                {
                    ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Could not classify link: " + array[i]);
                }
                else
                {
                    DocumentLibraryObjectId objectId = documentLibraryObjectId.ObjectId;
                    if (objectId != null)
                    {
                        UriFlags        uriFlags        = objectId.UriFlags;
                        DocumentLibrary documentLibrary = new DocumentLibrary();
                        bool            flag2           = DocumentLibraryUtilities.IsNavigationToWSSAllowed(base.UserContext);
                        bool            flag3           = DocumentLibraryUtilities.IsNavigationToUNCAllowed(base.UserContext);
                        UriFlags        uriFlags2       = uriFlags;
                        switch (uriFlags2)
                        {
                        case UriFlags.Sharepoint:
                            {
                                if (!flag2)
                                {
                                    throw new OwaSegmentationException("Access to Sharepoint documents is disabled");
                                }
                                SharepointSession sharepointSession = base.UserContext.LogonIdentity.CreateSharepointSession(objectId);
                                documentLibrary.DisplayName = (string.IsNullOrEmpty(sharepointSession.DisplayName) ? LocalizedStrings.GetNonEncoded(-527057840) : sharepointSession.DisplayName);
                                documentLibrary.SiteName    = sharepointSession.DisplayName;
                                break;
                            }

                        case UriFlags.Unc:
                            {
                                if (!flag3)
                                {
                                    throw new OwaSegmentationException("Access to Unc documents is disabled");
                                }
                                UncSession uncSession = base.UserContext.LogonIdentity.CreateUncSession(objectId);
                                documentLibrary.DisplayName = uncSession.Title;
                                documentLibrary.SiteName    = uncSession.Uri.Host;
                                break;
                            }

                        case UriFlags.Sharepoint | UriFlags.Unc:
                        case UriFlags.DocumentLibrary:
                            goto IL_34F;

                        case UriFlags.SharepointDocumentLibrary:
                        {
                            if (!flag2)
                            {
                                throw new OwaSegmentationException("Access to Sharepoint documents is disabled");
                            }
                            SharepointSession         sharepointSession2        = base.UserContext.LogonIdentity.CreateSharepointSession(objectId);
                            SharepointDocumentLibrary sharepointDocumentLibrary = SharepointDocumentLibrary.Read(sharepointSession2, objectId);
                            documentLibrary.DisplayName = (string.IsNullOrEmpty(sharepointDocumentLibrary.Title) ? LocalizedStrings.GetNonEncoded(477016274) : sharepointDocumentLibrary.Title);
                            documentLibrary.SiteName    = sharepointSession2.DisplayName;
                            break;
                        }

                        case UriFlags.UncDocumentLibrary:
                        {
                            if (!flag3)
                            {
                                throw new OwaSegmentationException("Access to Unc documents is disabled");
                            }
                            UncSession         session            = base.UserContext.LogonIdentity.CreateUncSession(objectId);
                            UncDocumentLibrary uncDocumentLibrary = UncDocumentLibrary.Read(session, objectId);
                            documentLibrary.DisplayName = (string.IsNullOrEmpty(uncDocumentLibrary.Title) ? LocalizedStrings.GetNonEncoded(477016274) : uncDocumentLibrary.Title);
                            documentLibrary.SiteName    = uncDocumentLibrary.Uri.Host;
                            break;
                        }

                        default:
                            switch (uriFlags2)
                            {
                            case UriFlags.SharepointFolder:
                            {
                                if (!flag2)
                                {
                                    throw new OwaSegmentationException("Access to Sharepoint documents is disabled");
                                }
                                SharepointSession sharepointSession3 = base.UserContext.LogonIdentity.CreateSharepointSession(objectId);
                                SharepointDocumentLibraryFolder sharepointDocumentLibraryFolder = SharepointDocumentLibraryFolder.Read(sharepointSession3, objectId);
                                documentLibrary.DisplayName = (string.IsNullOrEmpty(sharepointDocumentLibraryFolder.DisplayName) ? LocalizedStrings.GetNonEncoded(-527057840) : sharepointDocumentLibraryFolder.DisplayName);
                                documentLibrary.SiteName    = sharepointSession3.DisplayName;
                                break;
                            }

                            case UriFlags.UncFolder:
                            {
                                if (!flag3)
                                {
                                    throw new OwaSegmentationException("Access to Unc documents is disabled");
                                }
                                UncSession session2 = base.UserContext.LogonIdentity.CreateUncSession(objectId);
                                UncDocumentLibraryFolder uncDocumentLibraryFolder = UncDocumentLibraryFolder.Read(session2, objectId);
                                documentLibrary.DisplayName = (string.IsNullOrEmpty(uncDocumentLibraryFolder.DisplayName) ? LocalizedStrings.GetNonEncoded(-527057840) : uncDocumentLibraryFolder.DisplayName);
                                documentLibrary.SiteName    = uncDocumentLibraryFolder.Uri.Host;
                                break;
                            }

                            default:
                                goto IL_34F;
                            }
                            break;
                        }
                        documentLibrary.Type = uriFlags;
                        documentLibrary.Uri  = array[i];
                        int num = 0;
                        if (DocumentLibraryUtilities.AddFavorite(documentLibrary, base.UserContext, out num) && num <= 1000)
                        {
                            DocumentLibraryUtilities.RenderLibraryItem(this.Writer, documentLibrary, base.UserContext, true);
                            flag = true;
                            goto IL_3A0;
                        }
                        goto IL_3A0;
                        IL_34F:
                        throw new OwaNotSupportedException("Unhandled document library type");
                    }
                    ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "ObjectId could not be created from URI parameter: " + array[i]);
                }
                IL_3A0 :;
            }
            this.Writer.Write("</div>");
            if (flag)
            {
                this.Writer.Write("<div id=divMsgFav>");
                this.Writer.Write(LocalizedStrings.GetHtmlEncoded(344777715));
                this.Writer.Write("</div><div id=divMsgTtl>");
                this.Writer.Write(LocalizedStrings.GetHtmlEncoded(803639727));
            }
            else
            {
                this.Writer.Write("<div id=divNoLib>");
            }
            this.Writer.Write("</div>");
        }
		internal SharepointDocumentLibraryItemId(string id, string listName, Uri siteUri, CultureInfo cultureInfo, UriFlags uriFlags, ICollection<string> itemHierarchy) : base(id, listName, siteUri, cultureInfo, uriFlags)
		{
			if (itemHierarchy == null)
			{
				throw new ArgumentNullException("itemHierarchy");
			}
			if (itemHierarchy.Count < 1)
			{
				throw new ArgumentException("itemHierarchy");
			}
			this.itemHierarchy = new List<string>(itemHierarchy.Count);
			foreach (string text in itemHierarchy)
			{
				if (text.Length > 0 && (text[text.Length - 1] == '/' || text[text.Length - 1] == '\\'))
				{
					this.itemHierarchy.Add(text.Substring(0, text.Length - 1));
				}
				else
				{
					this.itemHierarchy.Add(text);
				}
			}
		}
示例#15
0
        private static ClassifyResult ClassifyUncLink(Uri uri, WindowsIdentity authenticatedUser)
        {
            WindowsImpersonationContext windowsImpersonationContext = null;
            ClassifyResult classifyResult = null;
            ClassifyResult result;

            try
            {
                windowsImpersonationContext = Utils.ImpersonateUser(authenticatedUser);
                UriFlags uriFlags = UriFlags.Other;
                if (!Utils.IsValidUncUri(uri))
                {
                    result = new ClassifyResult(uri, ClassificationError.InvalidUri);
                }
                else
                {
                    if (uri.Segments.Length == 1)
                    {
                        try
                        {
                            UncObjectId objectId   = new UncObjectId(uri, UriFlags.Unc);
                            UncSession  uncSession = UncSession.Open(objectId, new WindowsPrincipal(WindowsIdentity.GetCurrent()));
                            uncSession.GetView(null, null, new PropertyDefinition[0]);
                        }
                        catch (AccessDeniedException)
                        {
                            return(new ClassifyResult(uri, ClassificationError.AccessDenied));
                        }
                        catch (ObjectMovedOrDeletedException)
                        {
                            return(new ClassifyResult(uri, ClassificationError.ConnectionFailed));
                        }
                        uriFlags = UriFlags.Unc;
                    }
                    else if (uri.Segments.Length >= 2)
                    {
                        if (uri.Segments.Length >= 3)
                        {
                            try
                            {
                                FileSystemInfo fileSystemInfo = new FileInfo(uri.LocalPath);
                                if (fileSystemInfo.Attributes == (FileAttributes)(-1))
                                {
                                    return(new ClassifyResult(uri, ClassificationError.ObjectNotFound));
                                }
                                if ((fileSystemInfo.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
                                {
                                    uriFlags = UriFlags.UncFolder;
                                }
                                else
                                {
                                    uriFlags = UriFlags.UncDocument;
                                }
                            }
                            catch (UnauthorizedAccessException)
                            {
                                classifyResult = new ClassifyResult(uri, ClassificationError.AccessDenied);
                            }
                            catch (FileNotFoundException)
                            {
                                classifyResult = new ClassifyResult(uri, ClassificationError.ObjectNotFound);
                            }
                            catch (IOException)
                            {
                                classifyResult = new ClassifyResult(uri, ClassificationError.AccessDenied);
                            }
                        }
                        if (classifyResult != null || uri.Segments.Length == 2)
                        {
                            IntPtr intPtr;
                            int    num = UncSession.NetShareGetInfo(uri.Host, Uri.UnescapeDataString(uri.Segments[1].TrimEnd(new char[]
                            {
                                '\\',
                                '/'
                            })), 1, out intPtr);
                            if (intPtr != IntPtr.Zero)
                            {
                                UncSession.NetApiBufferFree(intPtr);
                            }
                            else if (num == 5 || num == 2311)
                            {
                                classifyResult = new ClassifyResult(uri, ClassificationError.AccessDenied);
                            }
                            else if (num == 53 || num == 2250)
                            {
                                classifyResult = new ClassifyResult(uri, ClassificationError.ConnectionFailed);
                            }
                            else if (num == 2310)
                            {
                                classifyResult = new ClassifyResult(uri, ClassificationError.ObjectNotFound);
                            }
                            else if (num != 0)
                            {
                                classifyResult = new ClassifyResult(uri, ClassificationError.UnknownError);
                            }
                            uriFlags = UriFlags.UncDocumentLibrary;
                        }
                        if (classifyResult != null)
                        {
                            return(classifyResult);
                        }
                    }
                    if ((uriFlags & UriFlags.Unc) != (UriFlags)0)
                    {
                        result = new ClassifyResult(new UncObjectId(uri, uriFlags), uri, uriFlags);
                    }
                    else
                    {
                        result = new ClassifyResult(uri, ClassificationError.ObjectNotFound);
                    }
                }
            }
            catch
            {
                Utils.UndoContext(ref windowsImpersonationContext);
                throw;
            }
            finally
            {
                Utils.UndoContext(ref windowsImpersonationContext);
            }
            return(result);
        }
示例#16
0
 internal ClassifyResult(DocumentLibraryObjectId objectId, Uri originalUri, UriFlags uriFlags)
 {
     this.objectId    = objectId;
     this.originalUri = originalUri;
     this.uriFlags    = uriFlags;
 }
示例#17
0
 private void RenderCrumb(string displayName, string uri, UriFlags libraryType, bool refreshViewer)
 {
     this.RenderCrumb(displayName, null, uri, libraryType, refreshViewer);
 }
示例#18
0
        // Token: 0x06003030 RID: 12336 RVA: 0x0011A360 File Offset: 0x00118560
        public static void RenderLibraryItem(TextWriter output, DocumentLibrary library, UserContext userContext, bool isFavorite)
        {
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }
            if (library == null)
            {
                throw new ArgumentNullException("library");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            output.Write("<div class=\"docFavItm\" title=\"");
            Utilities.HtmlEncode(library.DisplayName, output);
            output.Write("\n");
            Utilities.HtmlEncode(library.SiteName, output);
            output.Write("\n");
            Utilities.HtmlEncode(library.Uri, output);
            output.Write("\" ");
            string arg         = Utilities.JavascriptEncode(library.Uri);
            string handlerCode = string.Format("tbA(\"opendl\",new Array(\"{0}\",{1}));", arg, (int)library.Type);

            Utilities.RenderScriptHandler(output, "onclick", handlerCode);
            output.Write(" ");
            Utilities.RenderScriptHandler(output, "oncontextmenu", "shwDocMnu(_this," + (isFavorite ? "1" : "0") + ");");
            output.Write(" uri=\"{0}\" uf={1}><div class=\"docFavNmLine\">", Utilities.HtmlEncode(library.Uri), (int)library.Type);
            UriFlags type = library.Type;

            switch (type)
            {
            case UriFlags.Sharepoint:
            case UriFlags.Unc:
            case UriFlags.SharepointDocumentLibrary:
                goto IL_14E;

            case UriFlags.Sharepoint | UriFlags.Unc:
            case UriFlags.DocumentLibrary:
                goto IL_165;

            case UriFlags.UncDocumentLibrary:
                break;

            default:
                switch (type)
                {
                case UriFlags.SharepointFolder:
                    goto IL_14E;

                case UriFlags.UncFolder:
                    break;

                default:
                    goto IL_165;
                }
                break;
            }
            userContext.RenderThemeImage(output, ThemeFileId.Folder, "docFavItmImg", new object[0]);
            goto IL_165;
IL_14E:
            userContext.RenderThemeImage(output, ThemeFileId.WebFolder, "docFavItmImg", new object[0]);
IL_165:
            output.Write("<span id=\"spnDocFavDN\">");
            Utilities.HtmlEncode(library.DisplayName, output);
            output.Write("</span></div><span class=\"docFavSN\">");
            if (library.Type == UriFlags.UncDocumentLibrary || library.Type == UriFlags.UncFolder || library.Type == UriFlags.Unc)
            {
                output.Write("\\\\");
            }
            Utilities.HtmlEncode(library.SiteName, output);
            output.Write("</span></div>");
        }
示例#19
0
 protected internal DocumentLibraryObjectId(UriFlags uriFlags)
 {
     this.uriFlags = uriFlags;
 }
示例#20
0
 internal static ITableView InternalGetView(QueryFilter query, SortBy[] sortBy, DocumentLibraryQueryOptions queryOptions, PropertyDefinition[] propsToReturn, SharepointSession session, SharepointListId listId)
 {
     EnumValidator.ThrowIfInvalid <DocumentLibraryQueryOptions>(queryOptions, "queryOptions");
     if (propsToReturn == null)
     {
         throw new ArgumentNullException("propsToReturn");
     }
     if (propsToReturn.Length == 0)
     {
         throw new ArgumentException("propsToReturn");
     }
     return(Utils.DoSharepointTask <ArrayTableView>(session.Identity, new SharepointListId(listId.ListName, listId.SiteUri, listId.CultureInfo, UriFlags.SharepointList), listId, true, Utils.MethodType.GetView, delegate
     {
         XmlNode xmlNode = null;
         using (Lists lists = new Lists(listId.SiteUri.ToString()))
         {
             lists.Credentials = CredentialCache.DefaultCredentials;
             XmlNode query2 = null;
             QueryFilter queryFilter = null;
             if (queryOptions == DocumentLibraryQueryOptions.Files)
             {
                 queryFilter = new ComparisonFilter(ComparisonOperator.Equal, SharepointDocumentLibraryItemSchema.FileSystemObjectType, 0);
             }
             else if (queryOptions == DocumentLibraryQueryOptions.Folders)
             {
                 queryFilter = new ComparisonFilter(ComparisonOperator.Equal, SharepointDocumentLibraryItemSchema.FileSystemObjectType, 1);
             }
             if (query != null && queryFilter != null)
             {
                 query = new AndFilter(new QueryFilter[]
                 {
                     queryFilter,
                     query
                 });
             }
             else if (queryFilter != null)
             {
                 query = queryFilter;
             }
             if (query != null)
             {
                 query2 = SharepointHelpers.GenerateQueryCAML(query);
             }
             XmlNode viewFields = SharepointHelpers.GenerateViewFieldCAML(SharepointDocumentSchema.Instance, SharepointDocumentSchema.Instance.AllProperties.Keys);
             if (listId.CultureInfo == null)
             {
                 SharepointList sharepointList = SharepointList.Read(session, listId);
                 listId.CultureInfo = sharepointList.GetRegionalSettings();
             }
             SharepointDocumentLibraryItemId sharepointDocumentLibraryItemId = listId as SharepointDocumentLibraryItemId;
             XmlNode queryOptions2;
             if (sharepointDocumentLibraryItemId != null)
             {
                 queryOptions2 = SharepointHelpers.GenerateQueryOptionsXml(sharepointDocumentLibraryItemId.ItemHierarchy);
             }
             else
             {
                 queryOptions2 = SharepointHelpers.GenerateQueryOptionsXml(null);
             }
             xmlNode = lists.GetListItems(listId.ListName, null, query2, viewFields, Utils.GetViewMaxRows.ToString(), queryOptions2);
         }
         List <object[]> list = new List <object[]>();
         foreach (object obj in xmlNode.SelectNodes("/rs:data/z:row", SharepointHelpers.SharepointNamespaceManager))
         {
             XmlNode xmlNode2 = (XmlNode)obj;
             object[] valuesFromCAMLView = SharepointHelpers.GetValuesFromCAMLView(SharepointDocumentSchema.Instance, xmlNode2, listId.CultureInfo, new PropertyDefinition[]
             {
                 SharepointDocumentLibraryItemSchema.FileSystemObjectType,
                 SharepointDocumentLibraryItemSchema.ID,
                 SharepointDocumentLibraryItemSchema.EncodedAbsoluteUri
             });
             int num = 0;
             int num2 = num + 1;
             int num3 = num2 + 1;
             bool flag = valuesFromCAMLView[num] is bool && (bool)valuesFromCAMLView[num];
             UriFlags uriFlags = flag ? UriFlags.SharepointFolder : UriFlags.SharepointDocument;
             Uri uri = (Uri)valuesFromCAMLView[num3];
             List <string> list2 = new List <string>();
             for (int i = listId.SiteUri.Segments.Length; i < uri.Segments.Length; i++)
             {
                 list2.Add(Uri.UnescapeDataString(uri.Segments[i]));
             }
             SharepointDocumentLibraryItemId sharepointDocumentLibraryItemId2 = new SharepointDocumentLibraryItemId((string)valuesFromCAMLView[num2], listId.ListName, listId.SiteUri, listId.CultureInfo, uriFlags, list2);
             sharepointDocumentLibraryItemId2.Cache = new KeyValuePair <string, XmlNode>?(new KeyValuePair <string, XmlNode>(session.Identity.Name, xmlNode2));
             object[] valuesFromCAMLView2 = SharepointHelpers.GetValuesFromCAMLView(SharepointDocumentSchema.Instance, xmlNode2, listId.CultureInfo, propsToReturn);
             object obj2 = null;
             for (int j = 0; j < propsToReturn.Length; j++)
             {
                 if (((DocumentLibraryPropertyDefinition)propsToReturn[j]).PropertyId == DocumentLibraryPropertyId.Id)
                 {
                     valuesFromCAMLView2[j] = sharepointDocumentLibraryItemId2;
                 }
                 else if (propsToReturn[j] == SharepointDocumentSchema.VersionControl)
                 {
                     if (obj2 == null)
                     {
                         string text = SharepointHelpers.GetValuesFromCAMLView(SharepointDocumentSchema.Instance, xmlNode2, listId.CultureInfo, new PropertyDefinition[]
                         {
                             SharepointDocumentSchema.CheckedOutUserId
                         })[0] as string;
                         object obj3 = SharepointHelpers.GetValuesFromCAMLView(SharepointDocumentSchema.Instance, xmlNode2, listId.CultureInfo, new PropertyDefinition[]
                         {
                             SharepointDocumentSchema.VersionId
                         })[0];
                         if (obj3 is int && !flag)
                         {
                             obj2 = new VersionControl(!string.IsNullOrEmpty(text), text, (int)obj3);
                         }
                         else
                         {
                             obj2 = new PropertyError(propsToReturn[j], PropertyErrorCode.NotFound);
                         }
                     }
                     valuesFromCAMLView2[j] = obj2;
                 }
             }
             list.Add(valuesFromCAMLView2);
         }
         return new ArrayTableView(null, sortBy, propsToReturn, list);
     }));
 }
示例#21
0
        // Token: 0x06000741 RID: 1857 RVA: 0x00026D8C File Offset: 0x00024F8C
        public void Execute()
        {
            Uri uri = null;

            try
            {
                uri = new Uri(this.linkId);
            }
            catch (UriFormatException innerException)
            {
                AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, string.Format(CultureInfo.InvariantCulture, "DocumentLibrarySearchProvider: Bad Uri {0} was specified!", new object[]
                {
                    this.linkId
                }));
                this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "BadLinkInDocSearch");
                throw new AirSyncPermanentException(StatusCode.Sync_ProtocolError, innerException, false);
            }
            AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, this, "Processing Search command with Uri {0}.", uri.AbsoluteUri);
            if (!DocumentLibraryUtility.IsTrustedProtocol(uri.Scheme))
            {
                AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, string.Format(CultureInfo.InvariantCulture, "ItemOperationsFetchProvider: untrusted protocol: {0}!", new object[]
                {
                    uri.Scheme
                }));
                this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "BadProtocolInDocSearch");
                throw new AirSyncPermanentException(StatusCode.Sync_InvalidParameters, false);
            }
            if (!DocumentLibraryUtility.IsInternalUri(uri))
            {
                AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, string.Format(CultureInfo.InvariantCulture, "ItemOperationsFetchProvider: Uri must be internal: {0}!", new object[]
                {
                    uri.Host
                }));
                this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "ExternalProtocolInDocSearch");
                throw new AirSyncPermanentException(StatusCode.Sync_InvalidParameters, false);
            }
            AuthenticationContext authenticationContext = new AuthenticationContext();

            try
            {
                IPrincipal principal;
                if (this.userPassword == null)
                {
                    principal = this.user.WindowsPrincipal;
                    AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "DocumentLibrarySearchProvider: Created IPrincipal object from IAirSyncUser .");
                    if (principal == null)
                    {
                        if (GlobalSettings.EnableCredentialRequest && this.user.Context.Request.Version >= 121)
                        {
                            this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NeedPromptForCredsToProxy2");
                            throw new AirSyncPermanentException(StatusCode.Sync_InvalidWaitTime, false);
                        }
                        this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NeedCredsToProxy2");
                        throw new AirSyncPermanentException(HttpStatusCode.Forbidden, StatusCode.AccessDenied, null, false);
                    }
                }
                else
                {
                    SecurityStatus securityStatus = authenticationContext.LogonUser(this.userName, this.userPassword);
                    this.userPassword.Dispose();
                    this.userPassword = null;
                    if (securityStatus != SecurityStatus.OK)
                    {
                        AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, string.Format(CultureInfo.InvariantCulture, "DocumentLibrarySearchProvider: Authentication failed with status {0}.", new object[]
                        {
                            securityStatus
                        }));
                        this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, string.Format(CultureInfo.InvariantCulture, "AuthenticationErrorStatus{0}", new object[]
                        {
                            securityStatus
                        }));
                        throw new AirSyncPermanentException(HttpStatusCode.OK, StatusCode.Sync_ServerError, null, false);
                    }
                    principal = new WindowsPrincipal(authenticationContext.Identity);
                    AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "DocumentLibrarySearchProvider: Created IPrincipal using AuthenticationContext LogonUser method.");
                }
                ClassifyResult classifyResult = LinkClassifier.ClassifyLinks(principal, new Uri[]
                {
                    uri
                })[0];
                if (classifyResult.Error != ClassificationError.None)
                {
                    AirSyncDiagnostics.TraceDebug <string, ClassificationError>(ExTraceGlobals.RequestsTracer, this, "The LinkClassifier failed to classify the link {0}, returned {1}", this.linkId, classifyResult.Error);
                    switch (classifyResult.Error)
                    {
                    case ClassificationError.ConnectionFailed:
                        this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "LinkClassConnFailedInDocSearch");
                        throw new AirSyncPermanentException(HttpStatusCode.OK, StatusCode.Sync_Conflict, null, false);

                    case ClassificationError.AccessDenied:
                        this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "LinkClassDeniedInDocSearch");
                        throw new AirSyncPermanentException(HttpStatusCode.OK, StatusCode.Sync_ServerError, null, false);

                    case ClassificationError.ObjectNotFound:
                        this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "LinkClassNotFoundInDocSearch");
                        throw new AirSyncPermanentException(HttpStatusCode.OK, StatusCode.Sync_ClientServerConversion, null, false);

                    case ClassificationError.UriTypeNotSupported:
                    case ClassificationError.InvalidUri:
                        this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "LinkClassBadUriInDocSearch");
                        throw new AirSyncPermanentException(HttpStatusCode.OK, StatusCode.Sync_ProtocolError, null, false);
                    }
                    this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "LinkClassFailureInDocSearch");
                    throw new AirSyncPermanentException(StatusCode.Sync_InvalidSyncKey, false);
                }
                AirSyncDiagnostics.TraceDebug <UriFlags>(ExTraceGlobals.RequestsTracer, this, "Search command document type is {0}.", classifyResult.UriFlags);
                SharepointSession      sharepointSession     = null;
                UncSession             uncSession            = null;
                IDocumentLibraryItem   documentLibraryItem   = null;
                IDocumentLibrary       documentLibrary       = null;
                IDocumentLibraryFolder documentLibraryFolder = null;
                if ((classifyResult.UriFlags & UriFlags.Unc) == UriFlags.Unc)
                {
                    if (!DocumentLibraryUtility.IsUncAccessEnabled(this.user))
                    {
                        this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "AccessDeniedInDocSearch");
                        throw new AirSyncPermanentException(StatusCode.Sync_InvalidParameters, false);
                    }
                    if (DocumentLibraryUtility.IsBlockedHostName(uri.Host))
                    {
                        this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "HostBlockedInDocSearch");
                        throw new AirSyncPermanentException(StatusCode.Sync_InvalidParameters, false);
                    }
                    uncSession = UncSession.Open(classifyResult.ObjectId, principal);
                }
                else
                {
                    if ((classifyResult.UriFlags & UriFlags.Sharepoint) != UriFlags.Sharepoint)
                    {
                        AirSyncDiagnostics.TraceDebug <string, UriFlags>(ExTraceGlobals.RequestsTracer, this, "The Uri {0} of type {1} is not supported for Search", this.linkId, classifyResult.UriFlags);
                        this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "BadLinkInDocSearch2");
                        throw new AirSyncPermanentException(StatusCode.Sync_ProtocolError, false);
                    }
                    if (!DocumentLibraryUtility.IsWssAccessEnabled(this.user))
                    {
                        this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "WssDeniedInDocSearch");
                        throw new AirSyncPermanentException(StatusCode.Sync_InvalidParameters, false);
                    }
                    if (DocumentLibraryUtility.IsBlockedHostName(uri.Host))
                    {
                        this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "HostBlockedInDocSearch2");
                        throw new AirSyncPermanentException(StatusCode.Sync_InvalidParameters, false);
                    }
                    sharepointSession = SharepointSession.Open(classifyResult.ObjectId, principal);
                }
                UriFlags uriFlags = classifyResult.UriFlags;
                switch (uriFlags)
                {
                case UriFlags.Sharepoint:
                case UriFlags.Unc:
                    goto IL_645;

                case UriFlags.Sharepoint | UriFlags.Unc:
                case UriFlags.DocumentLibrary:
                    break;

                case UriFlags.SharepointDocumentLibrary:
                    documentLibrary = SharepointDocumentLibrary.Read(sharepointSession, classifyResult.ObjectId);
                    goto IL_645;

                case UriFlags.UncDocumentLibrary:
                    documentLibrary = UncDocumentLibrary.Read(uncSession, classifyResult.ObjectId);
                    goto IL_645;

                default:
                    switch (uriFlags)
                    {
                    case UriFlags.SharepointDocument:
                        documentLibraryItem = SharepointDocument.Read(sharepointSession, classifyResult.ObjectId);
                        goto IL_645;

                    case UriFlags.UncDocument:
                        documentLibraryItem = UncDocument.Read(uncSession, classifyResult.ObjectId);
                        goto IL_645;

                    default:
                        switch (uriFlags)
                        {
                        case UriFlags.SharepointFolder:
                            documentLibraryFolder = SharepointDocumentLibraryFolder.Read(sharepointSession, classifyResult.ObjectId);
                            goto IL_645;

                        case UriFlags.UncFolder:
                            documentLibraryFolder = UncDocumentLibraryFolder.Read(uncSession, classifyResult.ObjectId);
                            goto IL_645;
                        }
                        break;
                    }
                    break;
                }
                AirSyncDiagnostics.TraceDebug <string, UriFlags>(ExTraceGlobals.RequestsTracer, this, "The Uri {0} of type {1} is not supported for Search", this.linkId, classifyResult.UriFlags);
                this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "BadLinkInDocSearch3");
                throw new AirSyncPermanentException(StatusCode.Sync_ProtocolError, false);
IL_645:
                if (documentLibrary != null)
                {
                    AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Calling GetView() for document library...");
                    this.tableView = documentLibrary.GetView(null, DocumentLibrarySearchProvider.sortBy, DocumentLibraryQueryOptions.FoldersAndFiles, DocumentLibrarySearchProvider.documentLibraryProps);
                    this.rootProps = documentLibrary.GetProperties(DocumentLibrarySearchProvider.documentLibraryProps);
                }
                else if (documentLibraryFolder != null)
                {
                    AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Calling GetView() for document folder...");
                    this.tableView = documentLibraryFolder.GetView(null, DocumentLibrarySearchProvider.sortBy, DocumentLibraryQueryOptions.FoldersAndFiles, DocumentLibrarySearchProvider.documentLibraryProps);
                    this.rootProps = documentLibraryFolder.GetProperties(DocumentLibrarySearchProvider.documentLibraryProps);
                }
                else if (documentLibraryItem != null)
                {
                    AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Getting properties for the document item...");
                    this.rootProps = documentLibraryItem.GetProperties(DocumentLibrarySearchProvider.documentLibraryProps);
                }
                else if (sharepointSession != null)
                {
                    AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Calling GetView() on Sharepoint session...");
                    this.tableView    = sharepointSession.GetView(ListBaseType.DocumentLibrary, DocumentLibrarySearchProvider.documentLibraryProps);
                    this.rootProps    = new object[DocumentLibrarySearchProvider.airSyncProps.GetLength(0)];
                    this.rootProps[0] = sharepointSession.Uri;
                    this.rootProps[1] = sharepointSession.DisplayName;
                    this.rootProps[2] = true;
                }
                else
                {
                    AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Calling GetView() on UNC session...");
                    this.tableView    = uncSession.GetView(null, null, DocumentLibrarySearchProvider.documentLibraryProps);
                    this.rootProps    = new object[DocumentLibrarySearchProvider.airSyncProps.GetLength(0)];
                    this.rootProps[0] = uncSession.Uri;
                    this.rootProps[1] = uncSession.Title;
                    this.rootProps[2] = true;
                }
            }
            catch (UnknownErrorException innerException2)
            {
                this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "BadLinkInDocSearch4");
                throw new AirSyncPermanentException(StatusCode.Sync_ProtocolError, innerException2, false);
            }
            catch (AccessDeniedException innerException3)
            {
                this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "AccessDeniedInDocSearch2");
                throw new AirSyncPermanentException(StatusCode.Sync_ServerError, innerException3, false);
            }
            catch (ConnectionException innerException4)
            {
                this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "ConnFailedInDocSearch");
                throw new AirSyncPermanentException(StatusCode.Sync_Conflict, innerException4, false);
            }
            catch (ObjectNotFoundException innerException5)
            {
                this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NotFoundInDocSearch");
                throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, innerException5, false);
            }
            catch (DocumentLibraryException innerException6)
            {
                this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "FailureInDocSearch");
                throw new AirSyncPermanentException(StatusCode.Sync_InvalidSyncKey, innerException6, false);
            }
            finally
            {
                if (authenticationContext != null)
                {
                    authenticationContext.Dispose();
                    authenticationContext = null;
                }
            }
        }
示例#22
0
 // Token: 0x06002065 RID: 8293 RVA: 0x000BB6B8 File Offset: 0x000B98B8
 internal DocumentViewArrangeByMenu(UriFlags libraryType)
 {
     this.libraryType = libraryType;
 }
示例#23
0
 private void RenderCrumb(string displayName, Strings.IDs?untitledName, string uri, UriFlags libraryType, bool refreshViewer)
 {
     if (untitledName != null && string.IsNullOrEmpty(displayName))
     {
         displayName = LocalizedStrings.GetNonEncoded(untitledName.Value);
     }
     base.Writer.Write("<span dir=\"ltr\" ");
     Utilities.RenderScriptHandler(base.Writer, "oncontextmenu", "shwBrCrMnu(_this);");
     base.Writer.Write(" ");
     Utilities.RenderScriptHandler(base.Writer, "onclick", "opnDocFldr(_this.uri," + (refreshViewer ? "1" : "0") + ");");
     base.Writer.Write(" uri=\"");
     Utilities.HtmlEncode(uri, base.Writer);
     base.Writer.Write("\" uf=");
     base.Writer.Write((int)libraryType);
     base.Writer.Write("\">");
     Utilities.HtmlEncode(displayName, base.Writer);
     base.Writer.Write("</span>");
 }
示例#24
0
 internal SharepointSiteId(Uri siteUri, UriFlags uriFlags) : base(uriFlags)
 {
     this.siteUri = siteUri;
 }
示例#25
0
 internal SharepointSiteId(string siteUri, UriFlags uriFlags) : this(new Uri(siteUri), uriFlags)
 {
 }
示例#26
0
        // Token: 0x06003038 RID: 12344 RVA: 0x0011A938 File Offset: 0x00118B38
        public static ColumnId GetSortedColumn(ColumnId columnId, UriFlags libraryType)
        {
            DocumentSortType sortTypeofLibrary = DocumentLibraryUtilities.GetSortTypeofLibrary(columnId);
            ColumnId         result            = ColumnId.Count;

            switch (sortTypeofLibrary)
            {
            case DocumentSortType.Name:
                switch (libraryType)
                {
                case UriFlags.Sharepoint:
                    return(ColumnId.SharepointDocumentLibraryDisplayName);

                case UriFlags.Unc:
                case UriFlags.UncDocumentLibrary:
                    break;

                case UriFlags.Sharepoint | UriFlags.Unc:
                case UriFlags.DocumentLibrary:
                    return(result);

                case UriFlags.SharepointDocumentLibrary:
                    goto IL_73;

                default:
                    switch (libraryType)
                    {
                    case UriFlags.SharepointFolder:
                        goto IL_73;

                    case UriFlags.UncFolder:
                        break;

                    default:
                        return(result);
                    }
                    break;
                }
                result = ColumnId.UncDocumentDisplayName;
                break;
IL_73:
                result = ColumnId.SharepointDocumentDisplayName;
                break;

            case DocumentSortType.ModifiedByDate:
                switch (libraryType)
                {
                case UriFlags.Sharepoint:
                    return(ColumnId.SharepointDocumentLibraryLastModified);

                case UriFlags.Unc:
                case UriFlags.UncDocumentLibrary:
                    break;

                case UriFlags.Sharepoint | UriFlags.Unc:
                case UriFlags.DocumentLibrary:
                    return(result);

                case UriFlags.SharepointDocumentLibrary:
                    goto IL_C6;

                default:
                    switch (libraryType)
                    {
                    case UriFlags.SharepointFolder:
                        goto IL_C6;

                    case UriFlags.UncFolder:
                        break;

                    default:
                        return(result);
                    }
                    break;
                }
                result = ColumnId.UncDocumentLastModified;
                break;
IL_C6:
                result = ColumnId.SharepointDocumentLastModified;
                break;

            case DocumentSortType.FileSize:
                switch (libraryType)
                {
                case UriFlags.Sharepoint:
                    return(ColumnId.SharepointDocumentLibraryDisplayName);

                case UriFlags.Unc:
                    return(ColumnId.UncDocumentDisplayName);

                case UriFlags.Sharepoint | UriFlags.Unc:
                case UriFlags.DocumentLibrary:
                    return(result);

                case UriFlags.SharepointDocumentLibrary:
                    goto IL_121;

                case UriFlags.UncDocumentLibrary:
                    break;

                default:
                    switch (libraryType)
                    {
                    case UriFlags.SharepointFolder:
                        goto IL_121;

                    case UriFlags.UncFolder:
                        break;

                    default:
                        return(result);
                    }
                    break;
                }
                result = ColumnId.UncDocumentFileSize;
                break;
IL_121:
                result = ColumnId.SharepointDocumentFileSize;
                break;

            case DocumentSortType.Description:
                switch (libraryType)
                {
                case UriFlags.Sharepoint:
                    return(ColumnId.SharepointDocumentLibraryDisplayName);

                case UriFlags.Unc:
                case UriFlags.UncDocumentLibrary:
                    break;

                case UriFlags.Sharepoint | UriFlags.Unc:
                case UriFlags.DocumentLibrary:
                    return(result);

                case UriFlags.SharepointDocumentLibrary:
                    goto IL_1C7;

                default:
                    switch (libraryType)
                    {
                    case UriFlags.SharepointFolder:
                        goto IL_1C7;

                    case UriFlags.UncFolder:
                        break;

                    default:
                        return(result);
                    }
                    break;
                }
                result = ColumnId.UncDocumentDisplayName;
                break;
IL_1C7:
                result = ColumnId.SharepointDocumentLibraryDescription;
                break;

            case DocumentSortType.ModifiedBy:
                switch (libraryType)
                {
                case UriFlags.Sharepoint:
                    return(ColumnId.SharepointDocumentLibraryDisplayName);

                case UriFlags.Unc:
                case UriFlags.UncDocumentLibrary:
                    break;

                case UriFlags.Sharepoint | UriFlags.Unc:
                case UriFlags.DocumentLibrary:
                    return(result);

                case UriFlags.SharepointDocumentLibrary:
                    goto IL_25B;

                default:
                    switch (libraryType)
                    {
                    case UriFlags.SharepointFolder:
                        goto IL_25B;

                    case UriFlags.UncFolder:
                        break;

                    default:
                        return(result);
                    }
                    break;
                }
                result = ColumnId.UncDocumentDisplayName;
                break;
IL_25B:
                result = ColumnId.SharepointDocumentModifiedBy;
                break;

            case DocumentSortType.CheckedOutTo:
                switch (libraryType)
                {
                case UriFlags.Sharepoint:
                    return(ColumnId.SharepointDocumentLibraryDisplayName);

                case UriFlags.Unc:
                case UriFlags.UncDocumentLibrary:
                    break;

                case UriFlags.Sharepoint | UriFlags.Unc:
                case UriFlags.DocumentLibrary:
                    return(result);

                case UriFlags.SharepointDocumentLibrary:
                    goto IL_174;

                default:
                    switch (libraryType)
                    {
                    case UriFlags.SharepointFolder:
                        goto IL_174;

                    case UriFlags.UncFolder:
                        break;

                    default:
                        return(result);
                    }
                    break;
                }
                result = ColumnId.UncDocumentDisplayName;
                break;
IL_174:
                result = ColumnId.SharepointDocumentCheckedOutTo;
                break;

            case DocumentSortType.DocumentCount:
                switch (libraryType)
                {
                case UriFlags.Sharepoint:
                    return(ColumnId.SharepointDocumentLibraryItemCount);

                case UriFlags.Unc:
                case UriFlags.UncDocumentLibrary:
                    break;

                case UriFlags.Sharepoint | UriFlags.Unc:
                case UriFlags.DocumentLibrary:
                    return(result);

                case UriFlags.SharepointDocumentLibrary:
                    goto IL_214;

                default:
                    switch (libraryType)
                    {
                    case UriFlags.SharepointFolder:
                        goto IL_214;

                    case UriFlags.UncFolder:
                        break;

                    default:
                        return(result);
                    }
                    break;
                }
                result = ColumnId.UncDocumentDisplayName;
                break;
IL_214:
                result = ColumnId.SharepointDocumentDisplayName;
                break;
            }
            return(result);
        }
示例#27
0
 /// <summary>
 /// 修复绝对URI
 /// </summary>
 /// <param name="uri">URI</param>
 /// <param name="absoluteUri">绝对URI</param>
 /// <param name="removeFlags">删除状态</param>
 private static void setAbsolute(Uri uri, string absoluteUri, UriFlags removeFlags)
 {
     setFlags(uri, setAbsoluteUri(uri, absoluteUri) & (ulong.MaxValue ^ (ulong)removeFlags));
 }
示例#28
0
 internal SharepointItemId(string id, string listName, Uri siteUri, CultureInfo cultureInfo, UriFlags uriFlags) : base(listName, siteUri, cultureInfo, uriFlags)
 {
     if (string.IsNullOrEmpty(id))
     {
         throw new ArgumentException("id");
     }
     this.id = id;
 }
示例#29
0
 internal SharepointListId(string listName, Uri siteUri, CultureInfo cultureInfo, UriFlags uriFlags) : base(siteUri, uriFlags)
 {
     this.cultureInfo = cultureInfo;
     this.listName    = listName;
 }
示例#30
0
        private string TryNavigateToInternalWssUnc(string uriParam, out ErrorInformation errorInformation)
        {
            errorInformation = null;
            if (base.UserContext.IsBasicExperience)
            {
                return(null);
            }
            Uri uri = Utilities.TryParseUri(uriParam);

            if (uri == null || string.IsNullOrEmpty(uri.Scheme) || string.IsNullOrEmpty(uri.Host))
            {
                return(null);
            }
            if (!DocumentLibraryUtilities.IsTrustedProtocol(uri.Scheme))
            {
                return(null);
            }
            if (!DocumentLibraryUtilities.IsInternalUri(uri.Host, base.UserContext))
            {
                return(null);
            }
            if (DocumentLibraryUtilities.IsBlockedHostName(uri.Host, base.UserContext))
            {
                return(null);
            }
            if (!DocumentLibraryUtilities.IsDocumentsAccessEnabled(base.UserContext))
            {
                return(null);
            }
            bool flag  = DocumentLibraryUtilities.IsNavigationToWSSAllowed(base.UserContext);
            bool flag2 = DocumentLibraryUtilities.IsNavigationToUNCAllowed(base.UserContext);
            bool flag3 = Redir.IsHttpOrHttps(uri.Scheme);
            bool flag4 = string.Equals(uri.Scheme, Uri.UriSchemeFile, StringComparison.OrdinalIgnoreCase);

            if ((flag3 && !flag) || (flag4 && !flag2))
            {
                return(null);
            }
            ClassifyResult documentLibraryObjectId = DocumentLibraryUtilities.GetDocumentLibraryObjectId(uri, base.UserContext);

            if (documentLibraryObjectId == null || documentLibraryObjectId.Error != ClassificationError.None)
            {
                return(null);
            }
            DocumentLibraryObjectId objectId = documentLibraryObjectId.ObjectId;

            if (objectId == null)
            {
                return(null);
            }
            if (objectId.UriFlags == UriFlags.Other)
            {
                return(null);
            }
            UriFlags uriFlags = objectId.UriFlags;
            bool     flag5    = (uriFlags & UriFlags.SharepointDocument) == UriFlags.SharepointDocument;
            bool     flag6    = (uriFlags & UriFlags.UncDocument) == UriFlags.UncDocument;

            if ((uriFlags & UriFlags.DocumentLibrary) == UriFlags.DocumentLibrary || (uriFlags & UriFlags.Folder) == UriFlags.Folder || uriFlags == UriFlags.Sharepoint || uriFlags == UriFlags.Unc)
            {
                return(string.Concat(new string[]
                {
                    OwaUrl.ApplicationRoot.GetExplicitUrl(base.OwaContext),
                    "?ae=Folder&t=IPF.DocumentLibrary&id=",
                    Utilities.UrlEncode(objectId.ToBase64String()),
                    "&URL=",
                    Utilities.UrlEncode(uriParam)
                }));
            }
            if (flag5)
            {
                if (!base.UserContext.IsBasicExperience && DocumentLibraryUtilities.IsWebReadyDocument(objectId, base.UserContext))
                {
                    this.openWebReadyForm = true;
                    return("WebReadyView.aspx?t=wss&id=" + Utilities.UrlEncode(objectId.ToBase64String()) + "&URL=" + Utilities.UrlEncode(uriParam));
                }
                return(string.Concat(new string[]
                {
                    "ev.owa?ns=SharepointDocument&ev=GetDoc&id=",
                    Utilities.UrlEncode(objectId.ToBase64String()),
                    "&URL=",
                    Utilities.UrlEncode(uriParam),
                    Utilities.GetCanaryRequestParameter()
                }));
            }
            else
            {
                if (!flag6)
                {
                    return(null);
                }
                if (!base.UserContext.IsBasicExperience && DocumentLibraryUtilities.IsWebReadyDocument(objectId, base.UserContext))
                {
                    this.openWebReadyForm = true;
                    return("WebReadyView.aspx?t=unc&id=" + Utilities.UrlEncode(objectId.ToBase64String()) + "&URL=" + Utilities.UrlEncode(uriParam));
                }
                return(string.Concat(new string[]
                {
                    "ev.owa?ns=UncDocument&ev=GetDoc&id=",
                    Utilities.UrlEncode(objectId.ToBase64String()),
                    "&URL=",
                    Utilities.UrlEncode(uriParam),
                    Utilities.GetCanaryRequestParameter()
                }));
            }
        }