Copied to clipboard

Flag this post as spam?

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


  • Chris Rose 3 posts 23 karma points
    Jul 02, 2012 @ 18:58
    Chris Rose
    0

    Document.MakeNew does not send notifications

    Hi,

    Should I receive notifications when I create documents via the API or is this just limited to creating document via the content dashboard?

    Reason I ask is that I have created a webcontrol to allow a user to ask a question. When they submit it creates a document of type Question underneath an existing node named "Inbox".

    I have set up a "Create" notification on the "Inbox" document.

    When I login to the Umbraco Backoffice and create a child Document under the "Inbox" document node I receive an email notification as expected.

    When I try to create a document using the API with the code below, I can see that document is created in the content tree, however I don't receive the notifcation.

    Document docInbox = new Document(InboxFolderDocId);
    User author = User.getAllByLoginName("public")[0];
    DocumentType dt = DocumentType.GetByAlias("Question");
    Document doc = Document.MakeNew(niceUrl, dt, author, docInbox.Id);
    doc.getProperty("submittedByFirstName").Value = txtFirstName.Text;
    doc.getProperty("submittedByLastName").Value = txtLastName.Text;
    doc.getProperty("submittedByEmailAddress").Value = txtEmailAddress.Text;
    doc.getProperty("questionText").Value = txtQuestion.Text;
    doc.getProperty("answerText").Value = "answer goes here";
    doc.Save();
    

    Cheers,

    Chris.

     

     

     

  • Chris Rose 3 posts 23 karma points
    Jul 03, 2012 @ 10:28
    Chris Rose
    0

    I answered my own question. Yes they do, after a good nights sleep, but I'm not quite sure why they didn't work for me yesterday.

    Chris.

Please Sign in or register to post replies

Write your reply to:

Draft