Class Copy


  • public class Copy
    extends AbstractService
    Provides a Copy SharePoint web service class.

    Copy SharePoint Example

    The Groovy script example below illustrates using the Copy service to copy a Document to the SharePoint server. In this examples configuration Service Parameters are accessed via the serviceParameters map object.

     import com.avoka.component.sharepoint.SPClient
     import com.avoka.component.sharepoint.service.Copy
    
     // Create a SharePoint client using the Service Parameters map with the configured connection details
     def spClient = new SPClient(serviceParameters)
    
     // Create a Copy web service
     def copyService = spClient.getCopy()
    
     def path = "http://test-sharepoint/form/" + submission.receiptNumber + ".pdf"
     def displayName = submission.formName + " " + submission.receiptNumber
     def internalName = displayName
     def sourcePath = "http://null"
    
     // Copy document to location
     copyService.copyIntoItems(path, displayName, internalName, sourcePath, receiptPDF) 
    Since:
    3.5.0
    • Constructor Detail

      • Copy

        public Copy​(SPConnection sharePointConnection)
        Instantiate the Copy Interface wrapper with SharePoint Connection context
        Parameters:
        sharePointConnection - SharePoint connection context
    • Method Detail

      • copyIntoItems

        public CopyResult copyIntoItems​(String path,
                                        String displayName,
                                        String internalName,
                                        String sourcePath,
                                        byte[] data)
                                 throws SPException
        Copies a document to a location on the SharePoint Server. The method returns a CopyResult object which contains a result of the copy operation.

        Groovy Example

        The Groovy script example below illustrates using the Copy service to copy a Document to the SharePoint server.

        The example below is perform a submission delivery using the SPClient(Map) constructor, where the server connection details are configured as Service Parameters. The service parameters must include:

        • username - the SharePoint server login username
        • password - the SharePoint server login password
        • url - the SharePoint server URL
        • domain - the SharePoint server Domain
         // Provides a Groovy script based submission delivery process.
         //
         // Script parameters include:
         //    submission : com.avoka.fc.core.entity.Submission
         //    submissionXml : String
         //    receiptPDF : byte[]
         //    attachmentsMap : Map
         //    deliveryCheckpoint : com.avoka.fc.core.service.submission.DeliveryCheckpointService
         //    serviceDefinition : com.avoka.fc.core.entity.ServiceDefinition
         //    serviceParameters : Map
         import com.avoka.component.sharepoint.SPClient
         import com.avoka.component.sharepoint.service.Copy
        
         // Create a SharePoint client using the service parameters map with the configured connection details
         def spClient = new SPClient(serviceParameters)
        
         // Create a Copy web service
         def copyService = spClient.getCopy()
        
         // Copy the PDF receipt to location
         def path = "http://test-sharepoint/form/" + submission.receiptNumber + ".pdf"
         def displayName = submission.formName + " " + submission.receiptNumber
         def internalName = displayName
         def sourcePath = "http://null"
        
         def copyResult = copyService.copyIntoItems(path, displayName, internalName, sourcePath, receiptPDF) 

        Web Service Method

        The Microsoft SharePoint Web Service SOAP Method:

        http://schemas.microsoft.com/sharepoint/soap/CopyIntoItems

        The MSDN Method Reference:

        http://msdn.microsoft.com/en-us/library/copy.copy.copyintoitems.aspx

         

        Parameters:
        path - Destination url location of the copied item
        displayName - Item's display name field information
        internalName - Item's internal name field information
        sourcePath - Absolute source URL of the copied item
        data - Array of Base64 bytes containing the item
        Returns:
        CopyResult result of the copy item operation
        Throws:
        SPException - in case of SharePoint error response
      • getItem

        public byte[] getItem​(String path)
                       throws SPException
        Get a byte[] representation of a document by URL.

        Groovy Example

        The Groovy script example below illustrates using the Copy object to retrieve an Byte array item object. In this examples configuration Service Parameters are accessed via the serviceParameters map object.

         import com.avoka.component.sharepoint.SPClient
         import com.avoka.component.sharepoint.service.Copy
        
         // Create a SharePoint client using the service parameters map with the configured connection details
         def spClient = new SPClient(serviceParameters)
        
         // Create a Copy web service
         def copyService = spClient.getCopy()
        
         // Get an item byte array
         def itemData = copyService.getItem(serviceParameters.path) 

        Web Service Method

        The Microsoft SharePoint Web Service SOAP Method:

        http://schemas.microsoft.com/sharepoint/soap/GetItem

        The MSDN Method Reference:

        http://msdn.microsoft.com/en-us/library/copy.copy.getitem.aspx

         

        Parameters:
        path - Absolute server source URL of the item to be retrieved.
        Returns:
        byte[] Base64 Byte Array representing the item
        Throws:
        SPException - in case of SharePoint error response