Friday, 15.02.2019, 22:03

Engineer M DevelopmentMA

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

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=\"\" xmlns:xsd=\"\" xmlns:soap12=\"\">\n"
    "<CopyIntoItems xmlns=\"\">\n"
    "<SourceUrl>SharePoint Client</SourceUrl>\n"
    "<FieldInformation Type=\"Text\" DisplayName=\"Title\" InternalName=\"Title\" Id=\"{random_init}\" Value=\"Test Value\" />\n"

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="">
        <CopyResult ErrorCode="Success or DestinationInvalid or DestinationMWS or SourceInvalid or DestinationCheckedOut or InvalidUrl or Unknown" ErrorMessage="string" DestinationUrl="string" />

The successfully response will have ErrorCode="Success".

You can test all described options of the SharePoint on the website . 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 | Просмотров: 10484 | Добавил: 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  »
Друзья сайта
Copyright Macarov Anatoli © 2019
Free website builderuCoz