internal static void LoadList(CmdletContext ctx, List list, bool detailed)
 {
     ctx.Load(list);
     ctx.Load(list,
              l => l.RootFolder,
              l => l.DefaultViewUrl,
              l => l.HasUniqueRoleAssignments);
     if (detailed)
     {
         ctx.Load(list,
                  l => l.DefaultDisplayFormUrl,
                  l => l.DefaultEditFormUrl,
                  l => l.DefaultNewFormUrl,
                  l => l.IsSiteAssetsLibrary,
                  l => l.OnQuickLaunch,
                  l => l.SchemaXml,
                  l => l.UserCustomActions,
                  l => l.ValidationFormula,
                  l => l.ValidationMessage,
                  l => l.WorkflowAssociations);
         SPOFolder.LoadFolder(ctx, list.RootFolder, detailed, true);
     }
     else
     {
         ctx.ExecuteQuery();
     }
 }
Esempio n. 2
0
        internal static void LoadView(CmdletContext ctx, View view)
        {
            ctx.Load(view);
            ctx.Load(view, v => v.ViewFields);

            ctx.ExecuteQuery();
        }
        internal static void LoadContentType(CmdletContext ctx, ContentType ct)
        {
            ctx.Load(ct);
            ctx.Load(ct,
                     c => c.FieldLinks,
                     c => c.Fields,
                     c => c.Parent,
                     c => c.SchemaXmlWithResourceTokens,
                     c => c.WorkflowAssociations);

            ctx.ExecuteQuery();
        }
Esempio n. 4
0
 internal static void LoadSite(CmdletContext ctx, Site site, bool detailed)
 {
     ctx.Load(site);
     if (detailed)
     {
         ctx.Load(site,
                  s => s.CanUpgrade,
                  s => s.Owner,
                  s => s.RecycleBin,
                  s => s.UpgradeInfo,
                  s => s.Usage,
                  s => s.UserCustomActions);
     }
     ctx.ExecuteQuery();
 }
Esempio n. 5
0
 internal static void LoadWeb(CmdletContext ctx, Web web, bool detail)
 {
     ctx.Load(web);
     ctx.Load(web, w => w.HasUniqueRoleAssignments,
              w => w.EnableMinimalDownload);
     if (detail)
     {
         ctx.Load(web,
                  w => w.AllowDesignerForCurrentUser,
                  w => w.AllowMasterPageEditingForCurrentUser,
                  w => w.AllowRevertFromTemplateForCurrentUser,
                  w => w.AllProperties,
                  w => w.AlternateCssUrl,
                  w => w.AssociatedMemberGroup,
                  w => w.AssociatedOwnerGroup,
                  w => w.AssociatedVisitorGroup,
                  //w => w.AvailableContentTypes,
                  //w => w.AvailableFields,
                  //w => w.ContentTypes,
                  w => w.CurrentUser,
                  //w => w.EffectiveBasePermissions,
                  //w => w.EventReceivers,
                  //w => w.Features,
                  //w => w.Fields,
                  //w => w.FirstUniqueAncestorSecurableObject,
                  //w => w.Folders,
                  //w => w.Lists,
                  //w => w.ListTemplates,
                  w => w.Navigation,
                  w => w.RecycleBin,
                  w => w.RegionalSettings,
                  w => w.RoleAssignments,
                  w => w.RoleDefinitions,
                  //w => w.RootFolder,
                  w => w.SaveSiteAsTemplateEnabled,
                  w => w.ShowUrlStructureForCurrentUser,
                  //w => w.SiteGroups,
                  //w => w.SiteUserInfoList,
                  //w => w.SiteUsers,
                  w => w.SiteLogoUrl,
                  w => w.SupportedUILanguageIds,
                  w => w.ThemeInfo,
                  w => w.UserCustomActions,
                  w => w.WorkflowAssociations,
                  w => w.WorkflowTemplates);
     }
     ctx.ExecuteQuery();
 }
Esempio n. 6
0
 internal static void LoadSite(CmdletContext ctx, Site site, bool detailed)
 {
     ctx.Load(site);
     if (detailed)
     {
         // Some new bug is preventing the RecycleBin property from being populated.
         ctx.Load(site,
                  s => s.CanUpgrade,
                  s => s.Owner,
                  //s => s.RecycleBin,
                  s => s.UpgradeInfo,
                  s => s.Usage,
                  s => s.UserCustomActions);
     }
     ctx.ExecuteQuery();
 }
        internal static void LoadFile(CmdletContext ctx, File file)
        {
            ctx.Load(file);
            ctx.Load(file,
                     f => f.Author,
                     f => f.ModifiedBy,
                     f => f.CheckedOutByUser,
                     f => f.LockedByUser,
                     f => f.Versions);
            ctx.ExecuteQuery();

            try
            {
                ctx.Load(file, f => f.ListItemAllFields);
                ctx.ExecuteQuery();
            }
            catch { }
        }
        internal static SPOField GetField(CmdletContext ctx, FieldCollection fields, XmlDocument schemaXmlDoc)
        {
            Guid  fieldId = Guid.Parse(schemaXmlDoc.DocumentElement.GetAttribute("Id"));
            Field field   = fields.GetById(fieldId);

            ctx.Load(field);
            ctx.ExecuteQuery();
            if (!field.ServerObjectIsNull.Value)
            {
                return(new SPOField(field));
            }
            field = fields.GetByInternalNameOrTitle(schemaXmlDoc.DocumentElement.GetAttribute("Name"));
            ctx.Load(field);
            ctx.ExecuteQuery();
            if (!field.ServerObjectIsNull.Value)
            {
                return(new SPOField(field));
            }
            return(null);
        }
 internal static void LoadWebPart(CmdletContext ctx, WebPart webPart)
 {
     ctx.Load(webPart,
              wp => wp.Hidden,
              wp => wp.IsClosed,
              wp => wp.Properties,
              wp => wp.Subtitle,
              wp => wp.Title,
              wp => wp.TitleUrl,
              wp => wp.ZoneIndex);
     ctx.ExecuteQuery();
 }
        internal static SPOField GetField(CmdletContext ctx, FieldCollection fields, string nameOrTitle)
        {
            Field field = fields.GetByInternalNameOrTitle(nameOrTitle);

            ctx.Load(field);
            ctx.ExecuteQuery();
            if (!field.ServerObjectIsNull.Value)
            {
                return(new SPOField(field));
            }
            return(null);
        }
        internal static SPOContentType GetContentType(CmdletContext ctx, ContentTypeCollection contentTypes, string name)
        {
            ctx.Load(contentTypes);
            ctx.ExecuteQuery();

            foreach (ContentType ct in contentTypes)
            {
                if (ct.Name.ToLower() == name.ToLower())
                {
                    SPOContentType.LoadContentType(ctx, ct);
                    return(new SPOContentType(ct));
                }
            }
            return(null);
        }
 internal static void LoadFolder(CmdletContext ctx, Folder folder, bool detailed, bool isListContext)
 {
     ctx.Load(folder);
     ctx.Load(folder, f => f.Name, f => f.ServerRelativeUrl);
     if (detailed)
     {
         if (isListContext)
         {
             ctx.Load(folder,
                      f => f.ContentTypeOrder,
                      f => f.Folders,
                      f => f.Properties,
                      f => f.UniqueContentTypeOrder);
         }
         else
         {
             ctx.Load(folder,
                      f => f.Folders,
                      f => f.Properties);
         }
     }
     ctx.ExecuteQuery();
     if (!isListContext && detailed)
     {
         // There are some cases where we don't know if it's a list context until it's loaded.
         if (folder.Properties.FieldValues.ContainsKey("vti_listname") && folder.Properties["vti_listname"] != null)
         {
             ctx.Load(folder,
                      f => f.ContentTypeOrder,
                      f => f.Folders,
                      f => f.Properties,
                      f => f.UniqueContentTypeOrder);
             ctx.ExecuteQuery();
         }
     }
 }
Esempio n. 13
0
        private void IterateWebs(CmdletContext ctx, Web parentWeb, bool detailed)
        {
            var childWebs = parentWeb.Webs;

            ctx.Load(childWebs);
            ctx.ExecuteQuery();
            foreach (Web childWeb in childWebs)
            {
                SPOWeb.LoadWeb(ctx, childWeb, detailed);
                SPOWeb web = new SPOWeb(childWeb);
                if (web.WebTemplate != "APP" || (web.WebTemplate == "APP" && IncludeAppWebs))
                {
                    WriteObject(web);
                }
                IterateWebs(ctx, childWeb, detailed);
            }
        }
Esempio n. 14
0
 internal static SPOField GetField(CmdletContext ctx, FieldCollection fields, XmlDocument schemaXmlDoc)
 {
     Guid fieldId = Guid.Parse(schemaXmlDoc.DocumentElement.GetAttribute("Id"));
     Field field = fields.GetById(fieldId);
     ctx.Load(field);
     ctx.ExecuteQuery();
     if (!field.ServerObjectIsNull.Value)
     {
         return new SPOField(field);
     }
     field = fields.GetByInternalNameOrTitle(schemaXmlDoc.DocumentElement.GetAttribute("Name"));
     ctx.Load(field);
     ctx.ExecuteQuery();
     if (!field.ServerObjectIsNull.Value)
     {
         return new SPOField(field);
     }
     return null;
 }
Esempio n. 15
0
 private void IterateWebs(CmdletContext ctx, Web parentWeb, bool detailed)
 {
     var childWebs = parentWeb.Webs;
     ctx.Load(childWebs);
     ctx.ExecuteQuery();
     foreach (Web childWeb in childWebs)
     {
         SPOWeb.LoadWeb(ctx, childWeb, detailed);
         SPOWeb web = new SPOWeb(childWeb);
         if (web.WebTemplate != "APP" || (web.WebTemplate == "APP" && IncludeAppWebs))
             WriteObject(web);
         IterateWebs(ctx, childWeb, detailed);
     }
 }
        internal static void LoadContentType(CmdletContext ctx, ContentType ct)
        {
            ctx.Load(ct);
            ctx.Load(ct,
                c => c.FieldLinks,
                c => c.Fields,
                c => c.Parent,
                c => c.SchemaXmlWithResourceTokens,
                c => c.WorkflowAssociations);

            ctx.ExecuteQuery();
        }
        internal static SPOContentType GetContentType(CmdletContext ctx, ContentTypeCollection contentTypes, string name)
        {
            ctx.Load(contentTypes);
            ctx.ExecuteQuery();

            foreach (ContentType ct in contentTypes)
            {
                if (ct.Name.ToLower() == name.ToLower())
                {
                    SPOContentType.LoadContentType(ctx, ct);
                    return new SPOContentType(ct);
                }
            }
            return null;
        }
Esempio n. 18
0
        internal static void LoadFile(CmdletContext ctx, File file)
        {
            ctx.Load(file);
            ctx.Load(file,
                f => f.Author,
                f => f.ModifiedBy,
                f => f.CheckedOutByUser,
                f => f.LockedByUser,
                f => f.Versions);
            ctx.ExecuteQuery();

            try
            {
                ctx.Load(file, f => f.ListItemAllFields);
                ctx.ExecuteQuery();
            }
            catch { }
        }
Esempio n. 19
0
 internal static void LoadWeb(CmdletContext ctx, Web web, bool detail)
 {
     ctx.Load(web);
     ctx.Load(web, w => w.HasUniqueRoleAssignments,
         w => w.EnableMinimalDownload);
     if (detail)
     {
         ctx.Load(web,
             w => w.AllowDesignerForCurrentUser,
             w => w.AllowMasterPageEditingForCurrentUser,
             w => w.AllowRevertFromTemplateForCurrentUser,
             w => w.AllProperties,
             w => w.AlternateCssUrl,
             w => w.AssociatedMemberGroup,
             w => w.AssociatedOwnerGroup,
             w => w.AssociatedVisitorGroup,
             //w => w.AvailableContentTypes,
             //w => w.AvailableFields,
             //w => w.ContentTypes,
             w => w.CurrentUser,
             //w => w.EffectiveBasePermissions,
             //w => w.EventReceivers,
             //w => w.Features,
             //w => w.Fields,
             //w => w.FirstUniqueAncestorSecurableObject,
             //w => w.Folders,
             //w => w.Lists,
             //w => w.ListTemplates,
             w => w.Navigation,
             w => w.RecycleBin,
             w => w.RegionalSettings,
             w => w.RoleAssignments,
             w => w.RoleDefinitions,
             //w => w.RootFolder,
             w => w.SaveSiteAsTemplateEnabled,
             w => w.ShowUrlStructureForCurrentUser,
             //w => w.SiteGroups,
             //w => w.SiteUserInfoList,
             //w => w.SiteUsers,
             w => w.SiteLogoUrl,
             w => w.SupportedUILanguageIds,
             w => w.ThemeInfo,
             w => w.UserCustomActions,
             w => w.WorkflowAssociations,
             w => w.WorkflowTemplates);
     }
     ctx.ExecuteQuery();
 }
Esempio n. 20
0
 internal static void LoadSite(CmdletContext ctx, Site site, bool detailed)
 {
     ctx.Load(site);
     if (detailed)
     {
         ctx.Load(site,
             s => s.CanUpgrade,
             s => s.Owner,
             s => s.RecycleBin,
             s => s.UpgradeInfo,
             s => s.Usage,
             s => s.UserCustomActions);
     }
     ctx.ExecuteQuery();
 }
Esempio n. 21
0
 internal static void LoadWebPart(CmdletContext ctx, WebPart webPart)
 {
     ctx.Load(webPart,
         wp => wp.Hidden,
         wp => wp.IsClosed,
         wp => wp.Properties,
         wp => wp.Subtitle,
         wp => wp.Title,
         wp => wp.TitleUrl,
         wp => wp.ZoneIndex);
     ctx.ExecuteQuery();
 }
Esempio n. 22
0
 internal static void LoadList(CmdletContext ctx, List list, bool detailed)
 {
     ctx.Load(list);
     ctx.Load(list,
         l => l.RootFolder,
         l => l.DefaultViewUrl,
         l => l.HasUniqueRoleAssignments);
     if (detailed)
     {
         ctx.Load(list,
             l => l.DefaultDisplayFormUrl,
             l => l.DefaultEditFormUrl,
             l => l.DefaultNewFormUrl,
             l => l.IsSiteAssetsLibrary,
             l => l.OnQuickLaunch,
             l => l.SchemaXml,
             l => l.UserCustomActions,
             l => l.ValidationFormula,
             l => l.ValidationMessage,
             l => l.WorkflowAssociations);
         SPOFolder.LoadFolder(ctx, list.RootFolder, detailed, true);
     }
     else
         ctx.ExecuteQuery();
 }
Esempio n. 23
0
 internal static void LoadFolder(CmdletContext ctx, Folder folder, bool detailed, bool isListContext)
 {
     ctx.Load(folder);
     ctx.Load(folder, f => f.Name, f => f.ServerRelativeUrl);
     if (detailed)
     {
         if (isListContext)
         {
             ctx.Load(folder,
                 f => f.ContentTypeOrder,
                 f => f.Folders,
                 f => f.Properties,
                 f => f.UniqueContentTypeOrder);
         }
         else
         {
             ctx.Load(folder,
                 f => f.Folders,
                 f => f.Properties);
         }
     }
     ctx.ExecuteQuery();
     if (!isListContext && detailed)
     {
         // There are some cases where we don't know if it's a list context until it's loaded.
         if (folder.Properties.FieldValues.ContainsKey("vti_listname") && folder.Properties["vti_listname"] != null)
         {
             ctx.Load(folder,
                 f => f.ContentTypeOrder,
                 f => f.Folders,
                 f => f.Properties,
                 f => f.UniqueContentTypeOrder);
             ctx.ExecuteQuery();
         }
     }
 }
Esempio n. 24
0
        internal static void LoadView(CmdletContext ctx, View view)
        {
            ctx.Load(view);
            ctx.Load(view, v => v.ViewFields);

            ctx.ExecuteQuery();
        }
 internal static void LoadNavigation(CmdletContext ctx, Microsoft.SharePoint.Client.Navigation navigation)
 {
     ctx.Load(navigation, n => n.QuickLaunch, n => n.TopNavigationBar, n => n.UseShared);
     ctx.ExecuteQuery();
 }
Esempio n. 26
0
 internal static SPOField GetField(CmdletContext ctx, FieldCollection fields, string nameOrTitle)
 {
     Field field = fields.GetByInternalNameOrTitle(nameOrTitle);
     ctx.Load(field);
     ctx.ExecuteQuery();
     if (!field.ServerObjectIsNull.Value)
     {
         return new SPOField(field);
     }
     return null;
 }
Esempio n. 27
0
 internal static void LoadNavigation(CmdletContext ctx, Microsoft.SharePoint.Client.Navigation navigation)
 {
     ctx.Load(navigation, n => n.QuickLaunch, n => n.TopNavigationBar, n => n.UseShared);
     ctx.ExecuteQuery();
 }