SPFieldLinkCollection.Count-Eigenschaft
Ruft die Gesamtzahl der Spalten- oder Feldverweise in der Auflistung ab.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
Public Overrides ReadOnly Property Count As Integer
Get
'Usage
Dim instance As SPFieldLinkCollection
Dim value As Integer
value = instance.Count
public override int Count { get; }
Eigenschaftswert
Typ: System.Int32
Die Gesamtzahl der Elemente in der Auflistung.
Implementiert
Beispiele
Das folgende Beispiel zeigt eine Konsolenanwendung, die das Feld und Feld Link Auflistungen eines Inhaltstyps, der Wert der Eigenschaft InternalName für jedes Feld und den Wert der Eigenschaft Name für den entsprechenden Link Feld Drucken durchläuft.
Imports System
Imports Microsoft.SharePoint
Module ConsoleApp
Sub Main()
Dim site As SPSite = New SPSite("https://localhost")
Try
Dim web As SPWeb = site.OpenWeb()
Try
Dim ctName As String = "Announcement"
Dim contentType As SPContentType = web.ContentTypes(ctName)
If contentType IsNot Nothing Then
For i As Integer = 0 To contentType.FieldLinks.Count - 1
Console.WriteLine("Field.InternalName = {0}", _
contentType.Fields(i).InternalName)
Console.WriteLine("FieldLink.Name = {0}", _
contentType.FieldLinks(i).Name)
Console.WriteLine()
Next
End If
Finally
web.Dispose()
End Try
Finally
site.Dispose()
End Try
Console.Write("Press ENTER to continue...")
Console.ReadLine()
End Sub
End Module
using System;
using Microsoft.SharePoint;
namespace Test
{
class ConsoleApp
{
static void Main(string[] args)
{
using (SPSite site = new SPSite("https://localhost"))
{
using (SPWeb web = site.OpenWeb())
{
string ctName = "Announcement";
SPContentType contentType = web.ContentTypes[ctName];
if (contentType != null)
{
for (int i = 0; i < contentType.FieldLinks.Count; i++)
{
Console.WriteLine("Field.InternalName = {0}",
contentType.Fields[i].InternalName);
Console.WriteLine("FieldLink.Name = {0}",
contentType.FieldLinks[i].Name);
Console.WriteLine();
}
}
}
}
Console.Write("Press ENTER to continue...");
Console.ReadLine();
}
}
}
Die folgende Ausgabe wird in der Konsole angezeigt.
Field.InternalName = ContentType
FieldLink.Name = ContentType
Field.InternalName = Title
FieldLink.Name = Title
Field.InternalName = Body
FieldLink.Name = Body
Field.InternalName = Expires
FieldLink.Name = Expires
Press ENTER to continue...
Siehe auch
Referenz
Microsoft.SharePoint-Namespace