SpiraPlan: SoapService SOAP Web Service

See all operations

Document_AddFile

Description

Adds a new document (file) into the system and associates it with the provided artifact (optional) and project folder/type (optional)

Example(s)

            byte[] attachmentData = unicodeEncoding.GetBytes("Test Attachment Data To Be Stored");
            RemoteDocument remoteDocument = new RemoteDocument();
            remoteDocument.FilenameOrUrl = "test_data.xls";
            remoteDocument.Description = "Sample Test Case Attachment";
            remoteDocument.AuthorId = userId2;
            RemoteLinkedArtifact linkedArtifact = new RemoteLinkedArtifact
            { 
                ArtifactId = testCaseId1, 
                ArtifactTypeId = (int)DataModel.Artifact.ArtifactTypeEnum.TestCase 
            };
            remoteDocument.AttachedArtifacts.Add(linkedArtifact);
            attachmentId1 = spiraImportExport.Document_AddFile(credentials, remoteDocument, attachmentData).AttachmentId.Value;
            

Parameters

Type Name Required
RemoteCredentials? credentials - The API credentials
RemoteDocument? remoteDocument - The new document object (primary key will be empty)
base64Binary? binaryData - A byte-array containing the attachment itself in binary form

Return Value

RemoteDocument - The populated document object - including the primary key and default values for project attachment type and project folder if they were not specified