public SPOFilePipeBind(Microsoft.SharePoint.Client.File file) { if (!file.IsPropertyAvailable("ServerRelativeUrl")) { file.Context.Load(file, f => f.ServerRelativeUrl); file.Context.ExecuteQuery(); } _serverRelativeUrl = file.ServerRelativeUrl; }
private static void SetWelcomePage(Web web, Microsoft.SharePoint.Client.File pageFile) { if (!web.IsPropertyAvailable("RootFolder")) { web.Context.Load(web.RootFolder); web.Context.ExecuteQueryRetry(); } if (!pageFile.IsPropertyAvailable("ServerRelativeUrl")) { web.Context.Load(pageFile, p => p.ServerRelativeUrl); web.Context.ExecuteQueryRetry(); } var rootFolderRelativeUrl = pageFile.ServerRelativeUrl.Substring(web.RootFolder.ServerRelativeUrl.Length); web.SetHomePage(rootFolderRelativeUrl); }