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

我与影子孤独终老i 提交于 2019-12-23 16:18:29

问题


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

  1. Sitecore Item Web API Developer's Guide
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!