问题
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):
myitemname@domain.com
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:
Try to use HttpUtility.UrlEncode before passing the item name, e.g.:
string myItemName = "myitemname@domain.com";
var builder = ItemWebApiRequestBuilder.CreateItemRequestWithParentPath("/sitecore/content/home")
.ItemTemplatePath(@"User Defined/MyTemplate")
.ItemName(System.Web.HttpUtility.UrlEncode(myItemName));
More information in
- Sitecore Item Web API Developer's Guide
- Update an item using the Mobile SDK article.
来源:https://stackoverflow.com/questions/34200277/how-to-pass-sitecore-mobile-sdk-data-from-the-internet-has-unexpected-format