Thursday, 29.06.2017, 02:24

Engineer M DevelopmentMA

Главная » 2013 » January » 12 » SharePoint on iOS - part 2
SharePoint on iOS - part 2

The first part here.

How to get all server subsites? The SharePoint server can have websites (subsites), example 'mobile': .
To receive it you have to use the method GetWebCollection from directory (info -

The request look like:
NSString *soapMessage = @"\n"
"<soap12:Envelope xmlns:xsi=\"\" xmlns:xsd=\"\" xmlns:soap12=\"\">\n"
"<GetWebCollection xmlns=\"\" />\n"

The response:
<soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd="">
<GetWebCollectionResponse xmlns="">
<Web Title="Accounts" Url="" />
<Web Title="Mobile" Url="" />
<Web Title="Desktop" Url="" />

Ok. How to get a field value of the Item from a List?
Items can be received via method GetListItems. This method has some placeholders:
<GetListItems xmlns="">

- listName: is the Field ID or Name of a List, exists in the GetListCollection response. (example Name="{88299283-69DC-45B2-B4BF-4E5413ED4E50}", take a look at the first part of lesson);
- viewName: is the Name of View that provides methods for creating, deleting, or updating list views in SharePoint Services.
- query: is a schema of Collaborative Application Markup Language (CAML), uses for receive certain data of a List. (
- viewFields: is an enumeration of the Fields which you want to receive in the response. The Fields name gets through the GetListAndView method.
- rowLimit: to set a limit on Items in the response. Helps to make pagination.
- queryOptions: is a separate query properties. Effects on displaying data.
- webID: for defining a GUID of the parent Web site. Optional;

A simple request look like:
NSString *soapMessage = [NSString stringWithFormat:@"\n"
"<soap12:Envelope xmlns:xsi=\"\" xmlns:xsd=\"\" xmlns:soap12=\"\">\n"
"<GetListItems xmlns=\"\">\n"
, listName];

The response:
<rs:data ItemCount="2">
   <z:row ows_ID='1' ows_ContentType='Contact' ows_Title='Test 01'
ows_Modified='2013-01-10 11:22:30' ows_Created='2013-01-10 11:22:30'
ows_Author='2;#administrator' ows_Editor='2;#administrator'
ows__UIVersionString='1.0' ows_Attachments='0'
ows_Comments='&lt;div&gt;&lt;/div&gt;' ows__ModerationStatus='0'
ows__Level='1' ows_UniqueId='1;#{E98A638B-FA05-4946-BC54-5040036A688B}'
ows_FSObjType='1;#0' ows_MetaInfo='1;#' ows_owshiddenversion='1'
ows_FileLeafRef='1;#1_.000' ows_PermMask='0x1b03c4312ef'
ows_FileRef='1;#mobile/Lists/ContactTest/1_.000' />
   <z:row ows_ID='2' ows_ContentType='Contact' ows_Title='Test 02'
ows_Modified='2013-01-10 12:32:28' ows_Created='2013-01-10 12:32:28'
ows_Author='2;#administrator' ows_Editor='2;#administrator'
ows__UIVersionString='1.0' ows_Attachments='0'
ows_Comments='&lt;div&gt;&lt;/div&gt;' ows__ModerationStatus='0'
ows__Level='1' ows_UniqueId='2;#{26ACC5E9-105D-422A-91A3-F7FC94A5F522}'
ows_FSObjType='2;#0' ows_MetaInfo='2;#' ows_owshiddenversion='1'
ows_FileLeafRef='2;#2_.000' ows_PermMask='0x1b03c4312ef'
ows_FileRef='2;#mobile/Lists/ContactTest/2_.000' />

The response data contains two Items (ItemCount="2"), every Item begin with the node '<z:row .../>' . This node contain default attributes (Fields name). 
Example ows_ID='2': 
ows_ID is an attribute;
ID is a Field name;
'2' is a value;

All attributes has the prefix 'ows_', which you can remove before to add in array.
In the '' symbol exist value of Field, it's you have to display to users. By default an Item doesn't contain all Fields, which you can see via HTML website in a browser.
To get certain Fields of an Item you have to define a placeholder <viewFields>string</viewFields> . The Fields name you can take from the method GetListAndView. 

The SOAP request look like:
NSString *soapMessage = [NSString stringWithFormat:@"\n"
"<soap12:Envelope xmlns:xsi=\"\" xmlns:xsd=\"\" xmlns:soap12=\"\">\n"
"<GetListAndView xmlns=\"\">\n"
, listName];

This response contains a more information about a List and View. In the List data exist description of Fields, List properties and regional settings. The View data describes a view mode properties, defined Fields, limits by rows and query for data displaying.
Example you can find in this topic . The enumerations of Fields contains in the node <Fields>:
 ID="{64cd368d-2f95-4bfc-a1f9-8d8434ecb017}" ColName="tp_ID" ReadOnly="TRUE" Type="Counter" Name="ID" Hidden="TRUE" PrimaryKey="TRUE" DisplayName="ID" FromBaseType="TRUE" />
<Field ID="{64cd368d-2f95-4bfc-a1f9-8d4005ecb087}" Type="Text" Name="Title" DisplayName="Title" Required="TRUE" FromBaseType="TRUE" ColName="nvarchar1" />
<Field ID="{64cd368d-2f95-4bfc-a1f9-8d4324ecb777}" Type="Lookup" DisplayName="Parent" Required="FALSE" EnforceUniqueValues="FALSE" List="{b007aaf4-9de1-4694-b449-0ea5bf31d2b5}" ShowField="Title" UnlimitedLengthInDocumentLibrary="FALSE" RelationshipDeleteBehavior="None" ID="{87e663ef-9188-4a08-868d-b41060acb713}" SourceID="{aeaca6d9-984b-459f-98f8-9072c20ab599}" StaticName="Parent" Name="Parent" ColName="int4" RowOrdinal="0" WebId="8cf353a9-b786-4ea2-96fe-9744c2e99196" Version="1"/>
<Field ID="{64cd368d-2f95-4bfc-a1f9-8d4324ecb007}" Type="DateTime" Name="StartDate" DisplayName="Begindate" Format="DateOnly" SourceID="" StaticName="StartDate" ColName="datetime1"><Default>[today]</Default><DefaultFormulaValue>2013-01-13T00:00:00Z</DefaultFormulaValue></Field>
<Field ID="{7662cd2c-f069-4dba-9e35-082cf976e170}" Type="Note" RichText="FALSE" Name="Body" DisplayName="Description" Sortable="FALSE" SourceID="" StaticName="Body" ColName="ntext2" Required="FALSE" EnforceUniqueValues="FALSE" Indexed="FALSE" NumLines="6" RestrictedMode="TRUE" RichTextMode="Compatible" IsolateStyles="FALSE" AppendOnly="FALSE" Version="1" RowOrdinal="0"/>
<Field ID="{d2311440-1ed6-46ea-b46d-daa643dc3886}" Type="Number" Name="PercentComplete" Percentage="TRUE" Min="0" Max="1" DisplayName="% complete" SourceID="" StaticName="PercentComplete" ColName="float1"/>
<Field ID="{28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f}" ColName="tp_Modified" RowOrdinal="0" ReadOnly="TRUE" Type="DateTime" Name="Modified" DisplayName="ModifiedDate" StorageTZ="TRUE" SourceID="" StaticName="Modified" FromBaseType="TRUE"/>
<Field ID="{8c06beca-0777-48f7-91c7-6da68bc07b69}" ColName="tp_Created" RowOrdinal="0" ReadOnly="TRUE" Type="DateTime" Name="Created" DisplayName="CreateDate" StorageTZ="TRUE" SourceID="" StaticName="Created" FromBaseType="TRUE"/>
<Field ID="{1df5e554-ec7e-46a6-901d-d85a3881cb18}" ColName="tp_Author" RowOrdinal="0" ReadOnly="TRUE" Type="User" List="UserInfo" Name="Author" DisplayName="Created by" SourceID="" StaticName="Author" FromBaseType="TRUE"/>

This Fields response from my SP server and has more rows of data. I picked Fields by types. Some of them are understandable by name, others example: 
Lookup - is a listing of values from another List ID ( the data defined in the next attributes List="{b007aaf4-9de1-4694-b449-0ea5bf31d2b5}" ShowField="Title" );
DateTime - is a date and time value, it can be formatting via attribute Format="DateOnly" or "TimeOnly". This field has default value, that defined via the node <Default>. It's can have another Fields.;
User - is users which exist on the server.
If you want to add info about Item changes, the data contain Fields Created (created date), Modified (modified date), Author (created by author).
The Field contains necessary attributes which describe Name, Display name, Type, ID, Read only, Required, Hidden, Data formatting, Value, Source value. By these properties you can choose preferred Fields or create own query.
For filling the node <viewFields>string</viewFields> you have to parse the 'Name' attribute and don't need to add a prefix 'ows_'. The node can collect so:
[soapMessage appendFormat:@"<viewFields>\n<ViewFields>\n"];
for(Field *f in fieldList)
        [soapMessage appendFormat:@"<FieldRef Name='%@' />\n",];
[soapMessage appendFormat:@"</ViewFields>\n</viewFields>\n"];

For displaying correctly the Field, will be good to use attribute DisplayName. It can contain already translated name (like as on the WebSite) or more grammatically

Now you know how to receive fields and values of Item.

Категория: Lessons | Просмотров: 6647 | Добавил: admin | Рейтинг: 5.0/1 |
Всего комментариев: 0
Добавлять комментарии могут только зарегистрированные пользователи.
[ Регистрация | Вход ]
Меню сайта
Разделы новостей
Concept Software [2]
Programs are planned or under construction.
Software [10]
Release Software
Lessons [12]
About Me [1]
Infa about yourself, documents, certificates ...
Documentation [4]
Documentation of projects
Календарь новостей
«  January 2013  »
Друзья сайта
Copyright Macarov Anatoli © 2017
Free website builderuCoz