SPListItem.Copy Method (String, String, Hashtable, Byte )
Copies the specified item and its properties as a stream to the specified destination.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
Syntax
'Declaration
Public Shared Sub Copy ( _
sourceUrl As String, _
destinationUrl As String, _
properties As Hashtable, _
stream As Byte() _
)
'Usage
Dim sourceUrl As String
Dim destinationUrl As String
Dim properties As Hashtable
Dim stream As Byte()
SPListItem.Copy(sourceUrl, destinationUrl, _
properties, stream)
public static void Copy(
string sourceUrl,
string destinationUrl,
Hashtable properties,
byte[] stream
)
Parameters
sourceUrl
Type: System.StringThe URL of the source location of the item to copy, which is used to set the CopySource field of the copied item.
destinationUrl
Type: System.StringThe destination URL of the item.
Note
The destination URL must reside on the same server on which the code is running. This copy operation does not copy to URLs on remote servers.
properties
Type: System.Collections.HashtableThe metadata of the item.
stream
Type: []The item as a binary stream.
Exceptions
Exception | Condition |
---|---|
ArgumentException | sourceUrl or the destinationUrl is null or empty. -or- properties or stream is null . |
Remarks
This method copies the list item located at the sourceUrl and its properties specified by the properties parameter as a stream to the destination location specified by the destinationUrl parameter.