Compartilhar via


SearchAndProcessItem.Add Method

Adds the search and process job to the Microsoft Office SharePoint Server 2007 master timer job.

Namespace:  Microsoft.Office.RecordsManagement.SearchAndProcess
Assembly:  Microsoft.Office.Policy (in Microsoft.Office.Policy.dll)

Syntax

'Declaration
<PermissionSetAttribute(SecurityAction.InheritanceDemand, Name := "FullTrust")> _
<PermissionSetAttribute(SecurityAction.LinkDemand, Name := "FullTrust")> _
Public Function Add ( _
    web As SPWeb, _
    schedule As DateTime, _
    gParentId As Guid, _
    nItemId As Integer, _
    fRememberWebId As Boolean, _
    gItemGuid As Guid, _
    gBatchId As Guid, _
    nUserId As Integer _
) As Guid
'Usage
Dim instance As SearchAndProcessItem
Dim web As SPWeb
Dim schedule As DateTime
Dim gParentId As Guid
Dim nItemId As Integer
Dim fRememberWebId As Boolean
Dim gItemGuid As Guid
Dim gBatchId As Guid
Dim nUserId As Integer
Dim returnValue As Guid

returnValue = instance.Add(web, schedule, _
    gParentId, nItemId, fRememberWebId, _
    gItemGuid, gBatchId, nUserId)
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
[PermissionSetAttribute(SecurityAction.LinkDemand, Name = "FullTrust")]
public Guid Add(
    SPWeb web,
    DateTime schedule,
    Guid gParentId,
    int nItemId,
    bool fRememberWebId,
    Guid gItemGuid,
    Guid gBatchId,
    int nUserId
)

Parameters

  • schedule
    Type: System.DateTime

    The date and time when you want the search and process operation to run.

  • gParentId
    Type: System.Guid

    A GUID that identifies the parent of the work item.

  • nItemId
    Type: System.Int32

    A 32-bit integer that identifies a list item associated with the work item.

  • fRememberWebId
    Type: System.Boolean

    true to set the web identifier; otherwise, false.

  • gItemGuid
    Type: System.Guid

    A GUID that specifies a list item associated with the work item. Might return a null reference (Nothing in Visual Basic) if the work item was created without an SPListItemID (for example, an alerts work item).

  • gBatchId
    Type: System.Guid

    A GUID that specifies a context identifier to the job work item engine. The value can vary depending on the job type; for example, for alerts it may store a user ID but for workflow it would store a workflow ID.

  • nUserId
    Type: System.Int32

    The user on whose behalf the search and process operation is being performed.

Return Value

Type: System.Guid
A GUID that represents the GUID of the timer job created for this request.

Remarks

The Add method throws an exception if any of the following occurs:

  • The referenced assembly cannot be found, or does not implement the IProcess interface.

  • The time you have specified for the job to run is invalid. For example, you have specified a time in the past.

The search and process operation is created as a one-time, asynchronous timer job.

The nUserId parameter enables you to specify the user on whose behalf the search and process operation is being performed. Items to which the user does not have sufficient rights are not included in the return set of the search and process operations.

See Also

Reference

SearchAndProcessItem Class

SearchAndProcessItem Members

Microsoft.Office.RecordsManagement.SearchAndProcess Namespace