Lists.AddList method
Cria uma lista no site atual com base no nome especificado, a descrição e a ID do modelo de lista.
Namespace: WebSvcLists
Assembly: STSSOAP (in STSSOAP.dll)
Syntax
'Declaração
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/AddList", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function AddList ( _
listName As String, _
description As String, _
templateID As Integer _
) As XmlNode
'Uso
Dim instance As Lists
Dim listName As String
Dim description As String
Dim templateID As Integer
Dim returnValue As XmlNode
returnValue = instance.AddList(listName, _
description, templateID)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/AddList", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public XmlNode AddList(
string listName,
string description,
int templateID
)
Parâmetros
listName
Type: System.StringUma cadeia de caracteres que contém o título da lista.
description
Type: System.StringUma cadeia de caracteres que contém uma descrição para a lista.
templateID
Type: System.Int32Um inteiro de 32 bits que especifica o modelo de lista a ser usado. A tabela a seguir mostra os valores possíveis para a ID.
Valor retornado
Type: System.Xml.XmlNode
Um fragmento na Markup Language CAML (Collaborative Application) no seguinte formato que contém informações sobre a nova lista e que pode ser atribuído a um objeto System.Xml.XmlNode .
<List DocTemplateUrl="" DefaultViewUrl="/Site_Name/Lists/List_Name/AllItems.aspx"
ID="{6A823AF7-F9BD-45CB-B94E-8D37B343FB82}" Title="MyNewList"
Description="This was made with the AddList method"
ImageUrl="/_layouts/images/itgen.gif"
Name="{6A823AF7-F9BD-45CB-B94E-8D37B343FB82}" BaseType="0"
ServerTemplate="100"
Created="20030619 07:11:30" Modified="20030619 07:11:30"
LastDeleted="20030619 07:11:30"
Version="0" Direction="none" ThumbnailSize="0" WebImageWidth="0"
WebImageHeight="0"
Flags="4096" ItemCount="0" AnonymousPermMask="0"
RootFolder="Lists/MyNewList" ReadSecurity="1"
WriteSecurity="1" Author="1" EventSinkAssembly="" EventSinkClass=""
EventSinkData=""
EmailInsertsFolder=""
AllowDeletion="True"
AllowMultiResponses="False"
EnableAttachments="True"
EnableModeration="False"
EnableVersioning="False"
Hidden="False"
MultipleDataList="False"
Ordered="False"
ShowUser="True"
xmlns="https://schemas.microsoft.com/sharepoint/soap/">
<Fields>
<Field ColName="tp_ID" ReadOnly="TRUE" Type="Counter" Name="ID"
PrimaryKey="TRUE"
DisplayName="ID" FromBaseType="TRUE" />
<Field Type="Text" Name="Title" DisplayName="Title"
Required="TRUE" FromBaseType="TRUE"
ColName="nvarchar1" />
...
</Fields>
<RegionalSettings>
<Language>1033</Language>
<Locale>1033</Locale>
<AdvanceHijri>0</AdvanceHijri>
<CalendarType>1</CalendarType>
<Time24>False</Time24>
<TimeZone>480</TimeZone>
<SortOrder>2070</SortOrder>
<Presence>True</Presence>
</RegionalSettings>
</List>
Examples
O exemplo de código a seguir adiciona uma lista personalizada para o site atual.
Este exemplo exige que um using (Visual c#) ou a ser incluído no espaço para nome System.Xml de diretiva de Imports (Visual Basic).
Dim listService As New Web_Reference_Folder.Lists()
listService.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim ndList As XmlNode = listService.AddList("List_Name", "Description", 100)
MessageBox.Show(ndList.OuterXml)
Web_Reference_Folder.Lists listService = new Web_Reference_Folder.Lists();
listService.Credentials= System.Net.CredentialCache.DefaultCredentials;
XmlNode ndList = listService.AddList("List_Name","Description",100);
MessageBox.Show(ndList.OuterXml);