Share via


SPWDAExtensions.AddAttachment Method (DataRow, String, Stream)

Adds an attachment to the DataRow with the specified name and contents.

Namespace:  Microsoft.Office.SharePointWorkspace.AddIn.Data
Assembly:  Microsoft.Office.SharePointWorkspace.AddIn.Data (in Microsoft.Office.SharePointWorkspace.AddIn.Data.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function AddAttachment ( _
    dataRow As DataRow, _
    attachmentName As String, _
    attachmentStream As Stream _
) As Attachment
'Usage
Dim dataRow As DataRow
Dim attachmentName As String
Dim attachmentStream As Stream
Dim returnValue As Attachment

returnValue = dataRow.AddAttachment(attachmentName, _
    attachmentStream)
public static Attachment AddAttachment(
    this DataRow dataRow,
    string attachmentName,
    Stream attachmentStream
)

Parameters

  • attachmentName
    Type: System.String
    The file name of the attachment.

Return Value

Type: Microsoft.Office.SharePointWorkspace.AddIn.Data.Attachment
The newly created attachment.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DataRow. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=office.14) or https://msdn.microsoft.com/en-us/library/bb383977(v=office.14).

Remarks

The stream must remain open until after the after the attachment is committed with the Update method.

Note

Although this method appears present on all DataRow objects, you can call this method only on DataRow objects in DataSets that were either created by the Query method or filled by the Fill method or the FillSchema method. Calling this method on any other DataRow is unsupported and the results are undefined.

See Also

Reference

SPWDAExtensions Class

SPWDAExtensions Members

AddAttachment Overload

Microsoft.Office.SharePointWorkspace.AddIn.Data Namespace