Thursday, 29.06.2017, 02:24
| RSS

Engineer M DevelopmentMA

Главная » 2013 » February » 9 » SharePoint on iOS - part 4
SharePoint on iOS - part 4
17:49


How to copy data to the SharePoint server?

If you have some files and want to upload to the SP server via SOAP request, then you have to use method CopyIntoItems from the directory '_vti_bin/Copy.asmx'.
The SOAP request look like:
NSString *soapMessage = [NSString stringWithFormat: @"\n"
    "<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">\n"
    "<soap12:Body>\n"
    "<CopyIntoItems xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\">\n"
    "<SourceUrl>SharePoint Client</SourceUrl>\n"
    "<DestinationUrls>\n"
    "<string>server_url/Documents/sample.png</string>\n"
    "</DestinationUrls>\n"
    "<Fields>\n"
    "<FieldInformation Type=\"Text\" DisplayName=\"Title\" InternalName=\"Title\" Id=\"{random_init}\" Value=\"Test Value\" />\n"
    "</Fields>\n"
    "<Stream>%@</Stream>\n"
    "</CopyIntoItems>\n"
    "</soap12:Body>\n"
    "</soap12:Envelope>\n", 
base64];

The node 'SourceUrl' have to contain url of source file if it exist on the curent or external server; or contain some string (in my case 'SharePoint Client') if the file uploading from local machine. The node 'DestinationUrls' have to contain an enumeration of URLs, where you want to upload file and have access. Sometimes it can be URL of some Library. The node 'FieldInformation' can be removed or used for defining an Information. The node 'Stream' is importent element of method. It has to contain a file data in the base64 code.
The encode base64 can be implemented via the category NSData+Base64. The code you can download here.
Example of converting:
#import "NSData+Base64.h"

NSData *data = [NSData dataWithContentsOfFile:@"path to a file"];
NSString *base64 = [data base64EncodedString];


This string to set in the stream. After sending a request you will receive a response, like this:
<CopyIntoItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
      <CopyIntoItemsResult>unsignedInt</CopyIntoItemsResult>
      <Results>
        <CopyResult ErrorCode="Success or DestinationInvalid or DestinationMWS or SourceInvalid or DestinationCheckedOut or InvalidUrl or Unknown" ErrorMessage="string" DestinationUrl="string" />
      </Results>
</CopyIntoItemsResponse>


The successfully response will have ErrorCode="Success".

You can test all described options of the SharePoint on the website www.SeattleClouds.com . The SC helps to create a mobile app for iOS and Android os. The service is free for creating, testing and making presentation. There you can create the page SharePoint and test on the previewer app SeattleClouds.

Good luck and thanks for watching.
Категория: Lessons | Просмотров: 9557 | Добавил: admin | Рейтинг: 0.0/0 |
Всего комментариев: 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
Календарь новостей
«  February 2013  »
SuMoTuWeThFrSa
     12
3456789
10111213141516
17181920212223
2425262728
Поиск
Друзья сайта
Статистика
Copyright Macarov Anatoli © 2017
Free website builderuCoz