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 25, 2011 @ 09:11
    jivan thapa
    0

    Can not create DocumentType Using console application

    HI, I am new to umbraco.

    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;
            }

     

     

    Thanks

    Jivan

  • Richard Soeteman 3875 posts 12037 karma points MVP
    Mar 25, 2011 @ 10:38
    Richard Soeteman
    0

    Hi Jivan

    The document needs an HttpContext  so you can't create documents via a Console App. You can use a Webservice though.

    Cheers,

    Richard

     

  • jivan thapa 194 posts 681 karma points
    Mar 25, 2011 @ 11:17
    jivan thapa
    0

    thanks, Richard.

    what if i want to create DocumentType?

    Does webservice can create Document Type?

     

    Regards

    JIvan

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies