コード例 #1
0
 public SPOFilePipeBind(Microsoft.SharePoint.Client.File file)
 {
     if (!file.IsPropertyAvailable("ServerRelativeUrl"))
     {
         file.Context.Load(file, f => f.ServerRelativeUrl);
         file.Context.ExecuteQuery();
     }
     _serverRelativeUrl = file.ServerRelativeUrl;
 }
コード例 #2
0
        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);
        }