本文整理汇总了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);
}
}
}
});
}
}
}