a!shpCopyDocumentFromAppian() Function

Copies an Appian document to a location in SharePoint, specified by the value of the path parameter.

Syntax

a!shpCopyDocumentFromAppian( scsExternalSystemKey, usePerUserCredentials, hostname, port, path, httpMethod, timeout, retries, appianDocument, appianDocumentName, subsitePath)

Common Parameters:

scsExternalSystemKey: (Text) The key from the Third Party Credentials admin console page that corresponds to the set of credentials that should be used to authenticate.

usePerUserCredentials: (Boolean) If true the credentials set in the Third-Party Credentials settings page by the current user running the expression will be used. If false the site-wide credential values will be used.

hostname: (Text) The scheme and hostname of the SharePoint server. For example, https://sharepoint.example.com.

port: (Number (Integer)) The port on which to connect to the SharePoint server.

path: (Text) The path portion of the REST API URL to invoke. When referring to the SharePoint REST API Reference, this parameter is the part of the URL after the <site url> or <app web url> shown in the examples.

httpMethod: (Text) The HTTP method to invoke: The HTTP method to use when invoking the REST API. Valid values: "GET", "POST", "PUT", "DELETE", "MERGE"

timeout: (Number (Integer)) The amount of time, in milliseconds, to wait when attempting to connect to the SharePoint server.

retries: (Number (Integer)) The number of times to retry a connection that fails to connect within the given timeout period.

Specific Parameters:

appianDocument: (Document) The Appian document to copy to SharePoint.

subsitePath: (Text) Optional. The path portion of the REST API URL that represents the SharePoint subsite. It must start with a forward slash (/). Leave blank if accessing the base site.

Returns

Writer

This function returns a writer and must be used with the bind() function.

See also:

Examples

Copy a Document From Appian to SharePoint

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
=load(
  local!documentToSend,
  {
      a!pickerFieldDocuments(
        label: "Document To Send",
        maxSelections: 1,
        value: local!documentToSend,
        saveInto: local!documentToSend
      ),
      if(
        isnull(local!documentToSend),
        {},
        if(
          length(local!documentToSend) = 0,
          {},
          load(
            local!shpCopyDocumentFromAppianWriter: bind(
              null,
              a!shpCopyDocumentFromAppian(
                scsExternalSystemKey: "sharepoint",
                usePerUserCredentials: true,
                hostname: cons!SHAREPOINT_HOSTNAME,
                port: cons!SHAREPOINT_PORT,
                timeout: cons!SHAREPOINT_TIMEOUT,
                retries: cons!SHAREPOINT_NUM_RETRIES,
                path: "/_api/web/GetFolderByServerRelativeUrl('/Shared%20Documents')/Files/add(url='" &
                      document(local!documentToSend[1], "name") & "." & document(local!documentToSend[1], "extension") & "',overwrite=true)",
                appianDocument: _
              )
            ),
            a!buttonArrayLayout(
              buttons: {
                a!buttonWidget(
                  label: "Send File",
                  value: local!documentToSend,
                  saveInto: local!shpCopyDocumentFromAppianWriter
                )
              }
            )
          )
        )
      )
  }
)
FEEDBACK