public static BaseList GetList([NotNull] Uri webUrl, [NotNull] string listName, [NotNull] SpContext context) { Assert.ArgumentNotNull(context, "context"); Assert.ArgumentNotNull(webUrl, "webUrl"); Assert.ArgumentNotNull(listName, "listName"); var connector = new ListConnector(context, webUrl); return(ListFactory.CreateListObject(connector.GetList(listName), webUrl, context)); }
public static BaseList AddList([NotNull] string listName, [NotNull] string description, [NotNull] Uri webUrl, [NotNull] SpContext context, int templateID) { Assert.ArgumentNotNull(listName, "listName"); Assert.ArgumentNotNull(description, "description"); Assert.ArgumentNotNull(webUrl, "webUrl"); Assert.ArgumentNotNull(context, "context"); var connector = new ListConnector(context, webUrl); EntityValues listValues = connector.AddList(listName, description, templateID); return(ListFactory.CreateListObject(listValues, webUrl, context)); }
private void BackupThread() { try { Context.Communicator.AddListener(this); /*ListConnector inputConnector = Context.ConnectorRegistry.ConnectorForCommand(DuoCommands.InputSelectCommand) as ListConnector; * ListConnector cmsProfileConnector = Context.ConnectorRegistry.ConnectorForCommand(DuoCommands.DayNightCommand) as ListConnector; * * IList<IConnector> leftOverConnectors = new List<IConnector>(Context.ConnectorRegistry.AllConnectors()); * IList<IConnector> inputDependants = inputConnector.DependantConnectors(); * IList<IConnector> cmsDependants = cmsProfileConnector.DependantConnectors(); * * leftOverConnectors.Remove(inputConnector); * leftOverConnectors.Remove(cmsProfileConnector); * foreach (IConnector connector in inputDependants) * { * leftOverConnectors.Remove(connector); * } * foreach (IConnector connector in cmsDependants) * { * leftOverConnectors.Remove(connector); * }*/ ListConnector cmsProfileConnector = Context.ConnectorRegistry.ConnectorForCommand(DuoCommands.DayNightCommand) as ListConnector; IList <IConnector> cmsDependants = new List <IConnector>(Context.ConnectorRegistry.ConnectorsInCategory(CommandCategory.CMS)); cmsDependants.Remove(cmsProfileConnector); //refresh all commands /*Context.ConnectorRegistry.QueryAllCommands(); * communicationComplete.WaitOne(); * if (cancelled) * return;*/ IList <ConnectorRegistry.SerializableCommand> commands = new List <ConnectorRegistry.SerializableCommand>(); /*foreach (ListValue inputValue in DuoListValues.InputSelectValues) * { * //don't backup settings for input 'Auto': * if (inputValue.Value == 0) * continue; * * inputConnector.SetControlValue(inputValue); * * //wait for set and all queries to complete * communicationComplete.WaitOne(); * if (cancelled) * return; * * commands.Add(ConnectorRegistry.SerializableCommandForConnector(inputConnector)); * foreach (IConnector connector in inputDependants) * { * if (connector.ICommand.IsSavable) * { * commands.Add(ConnectorRegistry.SerializableCommandForConnector(connector)); * } * } * } * * * foreach (IConnector connector in leftOverConnectors) * { * if (connector.ICommand.IsSavable) * { * commands.Add(ConnectorRegistry.SerializableCommandForConnector(connector)); * } * }*/ foreach (ListValue profileValue in DuoListValues.DayNightProfileValues) { cmsProfileConnector.SetControlValue(profileValue); communicationComplete.WaitOne(); if (cancelled) { return; } commands.Add(ConnectorRegistry.SerializableCommandForConnector(cmsProfileConnector)); foreach (IConnector connector in cmsDependants) { if (connector.ICommand.IsSavable) { commands.Add(ConnectorRegistry.SerializableCommandForConnector(connector)); } } } ConnectorRegistry.SaveToFile(commands, filename); CloseDialog(); } finally { Context.Communicator.RemoveListener(this); } }