Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • jivan thapa 194 posts 681 karma points
    Mar 24, 2011 @ 15:50
    jivan thapa
    0

    Can not create DocumentType in console application

     

    HI, I try to create Document type using console application. but it says

    Value cannot be null.

    public int CreateNewDocumentType(string title, string alias, string description)
            {
               
                User u = new User(0);
                DocumentType newDocument = DocumentType.MakeNew(u, "aasds");
               // newDocument.Alias = alias;
                newDocument.Description = description;
                newDocument.IconUrl = "doc.png";
                newDocument.Save();
                    Document.RePublishAll();
                return DocumentType.GetByAlias(alias).Id;
             
                return 0;
            }

    How can i solve that problem?

    thanks.

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Mar 24, 2011 @ 18:22
    Ismail Mayat
    0

    When you mean console application you mean one that is not a website? If so then it wont work as the api needs the http context, there are webservice methods for creating documents etc you can call those from console application.

    Regards

    Ismail

  • jivan thapa 194 posts 681 karma points
    Mar 25, 2011 @ 13:30
    jivan thapa
    0

    thanks. Ismail.

    i will go to webservice.

     

Please Sign in or register to post replies

Write your reply to:

Draft