public Perm(FieldInfo info) : base(null, null) { var x = new FieldNodeInfo(info); Node = x.Node; Description = x.Description; Type = PermType.Grant; }
public PermissionsService() { var fields = findPerms(typeof(Perms)); foreach (var x in fields) { var node = new FieldNodeInfo(x); AllNodes[node.Node] = node; } }
/// <summary> /// Imports the field. /// </summary> /// <param name="fieldNode">The field node.</param> /// <exception cref="System.ArgumentNullException"></exception> public static void ImportField(IExplorerNode fieldNode) { if (fieldNode == null) { throw new ArgumentNullException("fieldNode"); } Microsoft.VisualStudio.SharePoint.Explorer.Extensions.IFieldNodeInfo nodeInfo = fieldNode.Annotations.GetValue <Microsoft.VisualStudio.SharePoint.Explorer.Extensions.IFieldNodeInfo>(); if (nodeInfo != null) { FieldNodeInfo fieldNodeInfo = new FieldNodeInfo { ContentTypeName = nodeInfo.ContentTypeName, Id = nodeInfo.Id, IsHidden = nodeInfo.IsHidden, ListId = nodeInfo.ListId, Title = nodeInfo.Title }; Dictionary <string, string> fieldProperties = null; if (String.IsNullOrEmpty(fieldNodeInfo.ContentTypeName) && fieldNodeInfo.ListId == Guid.Empty) { fieldProperties = fieldNode.Context.SharePointConnection.ExecuteCommand <FieldNodeInfo, Dictionary <string, string> >(SiteColumnsSharePointCommandIds.GetProperties, fieldNodeInfo); } else { fieldProperties = fieldNode.Context.SharePointConnection.ExecuteCommand <FieldNodeInfo, Dictionary <string, string> >(FieldSharePointCommandIds.GetProperties, fieldNodeInfo); } if (fieldProperties != null) { XNamespace xn = XNamespace.Get("http://schemas.microsoft.com/sharepoint/"); XElement xElements = new XElement(xn + "Elements", XElement.Parse(fieldProperties["SchemaXml"])); EnvDTE.Project activeProject = DTEManager.ActiveProject; if (activeProject != null) { ISharePointProjectService projectService = fieldNode.ServiceProvider.GetService(typeof(ISharePointProjectService)) as ISharePointProjectService; ISharePointProject activeSharePointProject = projectService.Projects[activeProject.FullName]; if (activeSharePointProject != null) { ISharePointProjectItem fieldProjectItem = activeSharePointProject.ProjectItems.Add(fieldProperties["InternalName"], "Microsoft.VisualStudio.SharePoint.Field"); System.IO.File.WriteAllText(Path.Combine(fieldProjectItem.FullPath, "Elements.xml"), xElements.ToString().Replace("xmlns=\"\"", String.Empty)); ISharePointProjectItemFile elementsXml = fieldProjectItem.Files.AddFromFile("Elements.xml"); elementsXml.DeploymentType = DeploymentType.ElementManifest; elementsXml.DeploymentPath = String.Format(@"{0}\", fieldProperties["InternalName"]); fieldProjectItem.DefaultFile = elementsXml; } } } } }
public static Dictionary <string, string> GetProperties(ISharePointCommandContext context, FieldNodeInfo field) { Dictionary <string, string> properties = null; if (field.Id != Guid.Empty) { properties = SharePointCommandServices.GetProperties(context.Site.RootWeb.Fields[field.Id]); } return(properties); }
public static Dictionary <string, string> GetProperties(ISharePointCommandContext context, FieldNodeInfo field) { Dictionary <string, string> properties = null; if (field.ListId == Guid.Empty) { properties = SharePointCommandServices.GetProperties(context.Web.AvailableContentTypes[field.ContentTypeName].Fields[field.Id]); } else { properties = SharePointCommandServices.GetProperties(context.Web.Lists[field.ListId].Fields[field.Id]); } return(properties); }