error in create new document

hadi tag asked on May 24, 2015 12:39

hi

when i create new document with this code :

node.Insert(parent, true);

in public class WebService : System.Web.Services.WebService

i get this error:

[TreeNode.Insert Internal]: The Documents Culture value is not specified.

why???

Recent Answers


Charles Matvchuk answered on May 24, 2015 15:26

Every document needs a culture, since every document can have multiple cultures. There error is self explanatory.

0 votesVote for this answer Mark as a Correct answer

hadi tag answered on May 24, 2015 15:42 (last edited on May 25, 2015 05:45)

thanks but

i set culture:

[WebMethod]
public bool InsertDocument(bool isArticle, ArticleResponse item)
{
var provider = new TreeProvider(UserInfoProvider.GetUserInfo("myUser"));
CMS.DocumentEngine.TreeNode parent = provider.SelectSingleNode(CMS.SiteProvider.SiteContext.CurrentSiteName, "/ART", CultureHelper.GetDefaultCultureCode(CMS.SiteProvider.SiteContext.CurrentSiteName), true, "CMS.MenuItem");
        TreeNode node = TreeNode.New("custom.Article", provider);

i use this code in web usercontrol and work very well. but when i use in webservice, this line get error

node.Insert(parent, true);

What is the problem?

0 votesVote for this answer Mark as a Correct answer

hadi tag answered on May 25, 2015 09:14 (last edited on May 25, 2015 09:16)

Why the code that work in uc.ascx.cs, do not work in webservice.cs (asmx)

Please help me

0 votesVote for this answer Mark as a Correct answer

Martin Danko answered on June 10, 2015 09:05

Hello Hadi,

I would recommend you to check the API Examples which, as I believe, could be really helpful.

You need to define the culture for a newly created document as well:

Set Document culture by calling node.DocumentCulture = "en-us"; before node.Insert(parent, true);

Best regards, Martin

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.