当前位置: 首页>>代码示例>>C#>>正文


C# SPWeb.GetListItem方法代码示例

本文整理汇总了C#中SPWeb.GetListItem方法的典型用法代码示例。如果您正苦于以下问题:C# SPWeb.GetListItem方法的具体用法?C# SPWeb.GetListItem怎么用?C# SPWeb.GetListItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SPWeb的用法示例。


在下文中一共展示了SPWeb.GetListItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RouteItem

        private void RouteItem(SPWeb web, SPListItem item)
        {
            bool routeSucceeded = false;
            EcmDocumentRoutingWeb routingWeb = new EcmDocumentRoutingWeb(web);
            string serverRelativeUrl = "Drop Off Library"; //EcmCommonUrls.GetServerRelativeUrl(SPContext.Current.Web, EcmCommonUrls.Id.DropOffZone, 需要多语言
            bool targetNotFound = false;
            string specifiedTargetUrl = string.Empty;
            if (routingWeb.IsRoutingEnabled)
            {
                SPListItem routeItem = item;
                SPFile file = routeItem.File;
                bool enableModeration = routeItem.ParentList.EnableModeration;
                bool fileOperationClear = false; //flag3
                if (file.CheckOutType != SPFile.SPCheckOutType.None)
                {
                    file.CheckIn(string.Empty);
                    fileOperationClear = true;
                }
                if (enableModeration && routeItem.DoesUserHavePermissions(SPBasePermissions.ApproveItems))
                {
                    file.Approve(string.Empty);
                    fileOperationClear = true;
                }
                if (fileOperationClear)
                {
                    routeItem = web.GetListItem(SPUrlUtility.CombineUrl(web.ServerRelativeUrl, routeItem.Url));
                    file = routeItem.File;
                }

                string displayName = routeItem.DisplayName;
                string finalUrl = web.Site.MakeFullUrl(file.ServerRelativeUrl);
                string docIdFromListItem = routeItem[new Guid("AE3E2A36-125D-45d3-9051-744B513536A6")] as string;
                SPUser currentUser = SPContext.Current.Web.CurrentUser;
                string str5;


                string routeDestination = string.Empty;
                bool routedExternally = false;
                ExternalRoutingResultProperties externalRouteResult = new ExternalRoutingResultProperties();
                bool flag4 = false;

                bool flag5 = true;
                if (enableModeration)
                {
                    flag5 = (routeItem.ModerationInformation != null) &&
                            (routeItem.ModerationInformation.Status == SPModerationStatusType.Approved);
                }
                if (flag5)
                {
                    flag4 = true;
                    SPSecurity.RunWithElevatedPrivileges(() =>
                    {
                        using (SPSite site = new SPSite(web.Site.ID))
                        {
                            using (SPWeb newWeb = site.OpenWeb(web.ID))
                            {
                                EcmDocumentRoutingWeb newRoutingWeb = new EcmDocumentRoutingWeb(newWeb);
                                try
                                {
                                    string finalDestination;
                                    bool wasRoutedToOtherWeb;
                                    routeSucceeded = newRoutingWeb.Router.RouteFileToFinalDestination(routeItem,
                                        out finalDestination, out wasRoutedToOtherWeb);
                                    //newRoutingWeb.Router.RouteFileToFinalLocationNowAsSystem(routeItem, web, currentUser, string.Empty, out routeDestination, out externalRouteResult);
                                    routedExternally = externalRouteResult.IsExternalRouter;
                                }
                                catch (DirectoryNotFoundException exception)
                                {
                                    routeSucceeded = false;
                                    specifiedTargetUrl = exception.Message;
                                    targetNotFound = !string.IsNullOrEmpty(specifiedTargetUrl);
                                }
                            }
                        }
                    });

                }

            }
        }
开发者ID:shrenky,项目名称:SPTestLab,代码行数:80,代码来源:RouterTest.aspx.cs


注:本文中的SPWeb.GetListItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。