0
有PublishingWeb.PagesList
和PublishingWeb.PagesListName
屬性,但其他列表的網址也因網站語言而異。那些我發現被翻譯爲:如何查找內置SharePoint列表名稱的區域翻譯?
- 文件
- 圖片
- 頁面
- 工作流任務
有一個在SP2010額外的API,但我該如何處理這個在2007年?
有PublishingWeb.PagesList
和PublishingWeb.PagesListName
屬性,但其他列表的網址也因網站語言而異。那些我發現被翻譯爲:如何查找內置SharePoint列表名稱的區域翻譯?
有一個在SP2010額外的API,但我該如何處理這個在2007年?
該數據可通過內部方法獲得。所以,我有一個調用的輔助方法:
[NotNull]
public static T Call<T>([CanBeNull] ref T cachedInvoker, [NotNull] Type subject, [NotNull] string methodName) where T : class
{
if (cachedInvoker == null)
{
var method = subject.GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic);
cachedInvoker = Delegate.CreateDelegate(typeof(T), method) as T;
if (cachedInvoker == null)
throw new ApplicationException(string.Format("Unable to create invoker for [{0}].[{1}].", subject, methodName));
}
return cachedInvoker;
}
然後我得到的數據:
[NotNull]
public static SPFolder Documents([NotNull] this PublishingWeb web)
{
return web.Lists[web.GetDocumentsListId()].RootFolder;
}
[NotNull]
public static string GetDocumentsListName([NotNull] this PublishingWeb web)
{
return web.Lists[web.GetDocumentsListId()].Title;
}
private static Func<PublishingWeb, Guid> getDocumentsListIdInvoker;
[NotNull]
public static Guid GetDocumentsListId([NotNull] this PublishingWeb web)
{
return
Internal.Call(ref getDocumentsListIdInvoker, typeof (PublishingWeb),
"get_DocumentsListId")(web);
}
[NotNull]
public static string GetImagesListName([NotNull] this PublishingWeb web)
{
return web.Lists[web.GetImagesListId()].Title;
}
private static Func<PublishingWeb, Guid> getImagesListIdInvoker;
[NotNull]
public static Guid GetImagesListId([NotNull] this PublishingWeb web)
{
return
Internal.Call(ref getImagesListIdInvoker, typeof(PublishingWeb),
"get_ImagesListId")(web);
}