How to pass "[Sitecore Mobile SDK] Data from the internet has unexpected format" Exception in Sitecore

224 views Asked by At

I am working on Sitecore Mobile SDK and I have a field named [Email]. I can't insert the data of Email's field into Sitecore because the exception :

[Sitecore Mobile SDK] Data from the internet has unexpected format

How I can fix this problem ?

Update : I update my question as request. My code as below :

var builder = ItemWebApiRequestBuilder.CreateItemRequestWithParentPath("/sitecore/content/home")
                          .ItemTemplatePath(@"User Defined/MyTemplate")
                          .ItemName("myItemName");

and AddFieldsRawValuesByNameToSet

builder.AddFieldsRawValuesByNameToSet("Email", txtEmail.Text);

Update 1: I have an item named as below (@ symbol):

[email protected]

I found my problem is when I update an item by

UpdateItemRequestWithId

it worked but if I use

CreateItemRequestWithParentPath

it throw the exception. I dont know why this.

1

There are 1 answers

7
Marek Musielak On BEST ANSWER

Try to use HttpUtility.UrlEncode before passing the item name, e.g.:

string myItemName = "[email protected]";
var builder = ItemWebApiRequestBuilder.CreateItemRequestWithParentPath("/sitecore/content/home")
                      .ItemTemplatePath(@"User Defined/MyTemplate")
                      .ItemName(System.Web.HttpUtility.UrlEncode(myItemName));

More information in

  1. Sitecore Item Web API Developer's Guide
  2. Update an item using the Mobile SDK article.