SharePoint - Get Files

Declaration

<AMSHAREPOINT ACTIVITY="get_files" SITE="text" 
VERSION="text (options)" AUTHTYPE="text (options)" USERNAME="text" 
PASSWORD="text (encrypted)" DOMAIN="text" 
IGNOREINVALIDCERTIFICATE="YES/NO" CERTIFICATE="text" 
PROXYTYPE="text (options)" PROXYSERVER="text" 
PROXYPORT="number" PROXYUSERNAME="text" 
PROXYPASSWORD="text (encrypted)" TIMEOUT="number" LIBRARY="text" 
RESULTDATASET="text" />

Description: Retrieves information about one or more files from the specified document library and populates a dataset with the results. This activity also allows you to further define data to retrieve using the Collaborative Application Markup Language (CAML) query feature, supported in SharePoint 2010. CAML is an XML-based query language that helps you query, build and customize Web sites based on Windows SharePoint Services. You can assign CAML query strings, for example, to the Query property of several classes in the server and client object models to return data, or to method parameters of the Lists Web Service to work remotely with data.

Practical Usage

Used to get information regarding files that reside in a particular SharePoint document library.

Connection Parameters

Property

Type

Required

Default

Markup

Description

Connection

---

---

---

---

Indicates where this activity's SharePoint credentials should originate from. This is a design-time parameter used only during task construction, thus, contains no properties or markups. The available options are:

  • Host - Specifies that a custom set of credentials will be entered for this activity. This option is normally selected if only a single SharePoint activity is required to complete the operation.

  • Session - Specifies that credentials should derive from a session created in a previous Create session step. This allows several activities to be linked to a specific session, eliminating redundancy. Multiple sessions can exist within a single task, allowing several SharePoint operations to be automated simultaneously.

Session

Text

Yes if Connection set to Session

SharePoint

Session1

SESSION="mySession1"

The name of the session to associate this activity with. This parameter is active only if the Connection parameter is set to Session. The default value is SharePointSession1.

NOTE: Use the End Session activity to end an active SharePoint session.

Version

Text (options)

Yes if Connection set to Host

SharePoint 2010

  1. VERSION="sharepointonline"

  2. VERSION="sharepoint2010"

  3. VERSION="sharepoint2007"

The SharePoint version to associate with this session. The available options are:

  • SharePoint Online - A cloud-based service, hosted by Microsoft as an alternative to installing and deploying SharePoint Server on premises.

  • SharePoint 2010 and newer (default) - SharePoint version 2010 or newer - includes SharePoint Foundation 2010/2013 and SharePoint Server 2010/2013.

  • SharePoint 2007 and older - SharePoint 2007 version - includes Windows SharePoint Services (WSS) v3 edition and Microsoft Office SharePoint Server 2007 (MOSS 2007) edition.

NOTE:  Some SharePoint activities are only supported in SharePoint 2010 or newer.

Site

Text

Yes

(Empty)

SITE="http://myServer/tech"

An existing SharePoint site to associate with this session. SharePoint sites are, functionally, ASP.NET 2.0 web applications that are served using IIS and a SQL Server database as a data storage back end. Active only if the Version parameter is set to SharePoint Online or SharePoint 2010 and newer.

Authentication type

Text (options)

No

Basic

  1. AUTHTYPE="form"

  2. AUTHTYPE="anonymous"

  3. AUTHTYPE="basic"

  4. AUTHTYPE="digest"

  5. AUTHTYPE="proprietary"

  6. AUTHTYPE="ntlm"

The method of authentication to use. Certain parameters become active depending on which authentication method is selected. Authentication types vary depending on the SharePoint version. Below lists available authentication methods and their compatibility.

  • Default - Compatible withSharePoint 2010 or newer.

  • Form - Compatible withSharePoint 2010 or newer.

  • Anonymous - Compatible withSharePoint 2010 or newer.

  • Basic - Compatible withall SharePoint versions.

  • Digest - Compatible withSharePoint 2007 or older.

  • Proprietary - Compatible withSharePoint 2007 or older.

  • None - Compatible withSharePoint 2007 or older.

  • NTLM - Compatible withSharePoint 2007 or older.

Username

Text

Yes

(Empty)

USERNAME="theUserName"

A valid SharePoint username. This parameter may or may not be active depending on which option is selected under the Authentication type parameter.

Password

Text

Yes

(Empty)

PASSWORD="encryptedText"

A valid SharePoint password. This parameter may or may not be active depending on which option is selected under the Authentication type parameter.

Domain

Text

Yes

(Empty)

DOMAIN="myServer"

The domain that the username (specified in the Username parameter) belongs to. This parameter may or may not be active depending on which option is selected under the Authentication type parameter.

Certificate

Text

No

(Empty)

CERTIFICATE="C:\Temp\file.cer"

The (DER encoded) certificate to use for SharePoint authentication. This parameter may or may not be active depending on which option is selected under the Authentication type parameter.

Ignore invalid certificate

Yes/No

No

No

IGNOREINVALIDCERTIFICATE="yes"

If set to YES, specifies that invalid server certificates that are detected will be automatically ignored. Set to NO by default.

Timeout (seconds)

Number

No

600

TIMEOUT="500"

The total number of seconds allowed to connect to the SharePoint server, otherwise a time out error is generated. The default value is 600 seconds.

Proxy type

Text (options)

No

Default

  1. PROXYTYPE="none"

  2. PROXYTYPE="http"

The proxy type to use. Required for SharePoint connections that pass through a proxy server. The available options are:

  • System default (default) - Points to the default proxy used by the system.

  • None - No proxy authentication required.

  • HTTP - Proxytype is HTTP.

Use authentication

---

---

---

---

If enabled, specifies that proxy authentication is required, enabling authentication-based parameters (disabled by default). This is a design-time parameter, therefore, contains no properties or markups. It is active only if the Proxy type parameter is set to HTTP.

Proxy server

Text

No

(Empty)

PROXYSERVER="proxy.host.com"

The host name (server.domain.com) or IP address (xxx.xxx.xxx.xxx) of the proxy server. This parameter is available only if the Proxy type parameter is set to HTTP.

Proxy username

Text

No

(Empty)

PROXYUSERNAME=username

The proxy username to authenticate with. This parameter is available only if the Use Authentication parameter is enabled.

Proxy password

Text

No

(Empty)

PROXYPASSWORD="encrypted"

The proxy password to authenticate with. This parameter is available only if the Use Authentication parameter is enabled.

Proxy port

Number

No

8080

PROXYPORT="8080"

The port that should be used to connect to the proxy server. The default port is 8080. This parameter is available only if the Proxy type parameter is set to HTTP.

File Parameters

Property

Type

Required

Default

Markup

Description

Document library title

Text

Yes

(Empty)

TITLE="library_title"

The title of the document library in which to retrieve file information from. Click the GO button to populate this field with available libraries. Click the folder icon to use the SharePoint Browser, a user-friendly interface that enables connection to a SharePoint site to view or select specific contents.

CAML Query

Text

Yes

(Empty)

LIBRARY="text"

The CAML Query to run.

NOTE: This option is only supported in SharePoint 2010.

Create and populate dataset with SharePoint file(s) information.

Text

Yes

(Empty)

RESULTDATASET="dataset_name"

The name of the dataset to create and populate with information about the file(s) that were queried. For additional details, see Datasets below.

Datasets

A dataset is a multiple column, multiple row container object where every column represents a particular variable, and each row corresponds to a given member of the dataset in question. This activity creates and populates a dataset containing specific fields (rows) in addition to the standard dataset fields. The table below describes these fields (assuming the dataset name assigned was theDataset).

Name

Type

Return Value

theDataset.Expires

Date

The expiration date/time of the file.

theDataset.Body

Text

The body of the file.

theDataset.Level

Text

The level of publication for the file.

theDataset.MetaInfo

Text

The unique ID of the list where the file resides.

theDataset.ProgID

Text

The Program identifier for the file.

theDataset.FileRef

Text

The file that is represented by the item from a document library.

theDataset.GUID

Text

The value that is contained by the field identified by the specified GUID.

theDataset.ModerationComments

Text

Content Approval information for the file, particularly any comments.

theDataset.ModerationStatus

Text

Content Approval information for the file, particularly the status.

theDataset.Attachments

Text

A collection of attachments that are associated with the file.

theDataset.CopySource

Text

The URL of the source item from which this item was copied, if the file results from a copy operation.

theDataset.Editor

Text

The editor of the file.

theDataset.Author

Text

The author of the file.

theDataset.Created

Date

The date/time the file was initially created. The returned date/time format matches the following: MM/DD/YYYY HH:MM:SS AM/PM.

theDataset.Modified

Date

The date/time the file was last modified. The returned date/time format matches the following: MM/DD/YYYY HH:MM:SS AM/PM.

theDataset.Title

Text

The title of the file.

theDataset.ContentTypeID

Text

The identifier of the content type that is associated with this file.

theDataset.ID

Text

The integer that identifies the file.

Example

The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Description: Get SharePoint library "Shared Documents" file(s) and store information in dataset "test". Site url is "http://winserv201/my/personal/files".

This sample is for AML viewing purposes only. In order for the task to work, it must be modified to fit your SharePoint credentials.

<AMSHAREPOINT ACTIVITY="get_files" LIBRARY="Shared Documents" 
RESULTDATASET="test" SITE="http://winserv201/my/personal/files" 
AUTHTYPE="Basic" USERNAME="administrator" PASSWORD="AM2RzswreJs0SU=aME" 
DOMAIN="winserv08r2">&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef 
Name='Country' /&gt;&lt;Value Type='Lookup'&gt;Belgium&lt;
/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;</AMSHAREPOINT>