This documentation is archived and is not being maintained.

SPBuiltInFieldId._Author Field

Windows SharePoint Services 3

Returns a GUID that represents the author of the specified Windows SharePoint Services object.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public static readonly Guid _Author

SPSite oSiteCollection = SPContext.Current.Site;

SPWebCollection collWebsites = oSiteCollection.AllWebs;

foreach (SPWeb oWebsite in collWebsites)

{

SPListCollection collLists = oWebsite.Lists;

foreach (SPList oList in collLists)

{

if (oList.BaseType == SPBaseType.DocumentLibrary)

{

SPDocumentLibrary oDocumentLibrary = (SPDocumentLibrary)oList;

if (!oDocumentLibrary.IsCatalog && oList.BaseTemplate !=

SPListTemplateType.XMLForm)

{

// get the guid of the '_Author' column

SPField siteColumn =

oDocumentLibrary.Fields[SPBuiltInFieldId._Author);

// create a field link to the column

SPFieldLink link = SPFieldLink(siteColumn);

// Find the SPContentType for this list

SPContentType anncOnList = taskList.ContentTypes[anncType.Name];

// Look for the last item on the list and get its name

anncOnList.FieldLinks[anncOnList.FieldLinks.Count - 1].Name

}

}

oWebsite.Dispose();

}

NoteNote

Certain objects implement the IDisposable interface and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Best Practices: Using Disposable Windows SharePoint Services Objects.

Show: