online source control
back to content
sign up free version control plan

ISAWHAppObject::AddFiles

Description

Adds multiple files to an existing project on the server.

Syntax

long AddFiles(
        ISAWHAddFileSet*
AddFileSet,
        VARIANT_BOOL
UseReadOnly,
        BSTR Comment,
        Enum_CompareFileBy
CompareFileBy,
        Enum_SetLocalFileTime
SetLocalFileTime,
        VARIANT_BOOL
RemoveLocalCopy,
        VARIANT_BOOL*
Cancelled,
        BSTR*
ResultDescription,
        ISAWHOperationResultSet*
OperationResultSet
);

Parameters

AddFileSet
[in] Specifies the full names of files to be added.

UseReadOnly
[in] Specifies whether to use read-only flag on the unchecked-out local file copies after the Add operation.

Comment
[in] Specifies the comments for the Add operation.

CompareFileBy
[in] Specifies how to determine if the local copy is up-to-date, by checksum or by date/time.

SetLocalFileTime
[in] Specifies how to set the date/time of the local file.

RemoveLocalCopy
[in] Specifies whether to delete the local file copies after the Add operation.

Cancelled
[out] If the method fails, returns whether the operation is cancelled.

ResultDescription
[out] Returns the description of the return value. If the method succeeds, returns 'Completed'. If the method fails, returns the description of the error.

OperationResultSet
[out] Returns the result information set of the operation.

Return Value

If the method succeeds, returns 0. If the method fails, returns other error codes.

See Also

Sample

VB Sample:

Dim WithEvents sdkObject As SAWHSDKLib.SAWHAppObject

Set sdkObject = New SAWHSDKLib.SAWHAppObject

Private Sub AddFiles_Click()

	Dim AddFileSet As New SAWHAddFileSet
	Dim Comment As String
	Dim Cancelled As Boolean
	Dim ResultDescription As String
	Dim OperationResultSet As New SAWHOperationResultSet

	Dim AddFile As New SAWHAddFile
	AddFile.FileType = Enum_Autodetect
	AddFile.LocalFileName = "D:\LocalFile1.txt"
	AddFile.RemoteFileName = "$/FileName1.txt"
	AddFileSet.Add AddFile

	AddFile.FileType = Enum_Autodetect
	AddFile.LocalFileName = "D:\LocalFile2.txt"
	AddFile.RemoteFileName = "$/FileName2.txt"
	AddFileSet.Add AddFile

	Comment = "Add files"

	Dim ResultValue As Long
	ResultValue = sdkObject.AddFiles(AddFileSet, True, Comment, Enum_CompareFileByChecksum, Enum_SetLocalFileTimeCurrent, False, Cancelled, ResultDescription, OperationResultSet)
	
	If ResultValue <> 0 Then
		MsgBox "Failed to add the file(s)."
	End If

End Sub