本文整理汇总了C#中Folder.EnsureProperties方法的典型用法代码示例。如果您正苦于以下问题:C# Folder.EnsureProperties方法的具体用法?C# Folder.EnsureProperties怎么用?C# Folder.EnsureProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Folder
的用法示例。
在下文中一共展示了Folder.EnsureProperties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnsureFolder
/// <summary>
/// Ensure that the folder structure is created. This also ensures hierarchy of folders.
/// </summary>
/// <param name="web">Web to be processed - can be root web or sub site</param>
/// <param name="parentFolder">Parent folder</param>
/// <param name="folderPath">Folder path</param>
/// <returns>The folder structure</returns>
public static Folder EnsureFolder(this Web web, Folder parentFolder, string folderPath)
{
web.EnsureProperties(w => w.ServerRelativeUrl);
parentFolder.EnsureProperties(f => f.ServerRelativeUrl);
var parentWebRelativeUrl = parentFolder.ServerRelativeUrl.Substring(web.ServerRelativeUrl.Length);
var webRelativeUrl = parentWebRelativeUrl + (parentWebRelativeUrl.EndsWith("/") ? "" : "/") + folderPath;
return web.EnsureFolderPath(webRelativeUrl);
}