1

I'm very newless with Sharepoint... I'm trying developt an Add-In solution in Sharepoint Online and I'm using sharepoint Plus library. I want to add a user to Attendees column in a Calendar List, but I don't know that object or value must pass to make it.

$SP().list("CalendarList1").add({
        Title: "Meeting 1",
        EventDate: "2019-04-18 10:00:00",
        EndDate: "2019-04-18 11:00:00",
        Location: "Conference Room",
        Description: "Tes add Users...",
        Attendees: "HERE the problem" //<== I try with  SP.FieldUserValue.fromUser("user@domain.onmicrosoft.com"), but it fails
    }).then(function (items) {
        console.log(items); 
    });

PD: sorry if the question is very basic!

0

For the SharePoint Plus library, to set a person field must be provided as "-1;#email" (e.g. "-1;#foo@bar.com") OR NT login with double \ (eg "-1;#europe\foo_bar") OR the user ID as a number.

You can check the source code of the SharePoint Plus library.

/** @name $SP().list.add
      @function
      @description Add items into a Sharepoint List
                   note: A Date must be provided as "YYYY-MM-DD" (only date comparison) or "YYYY-MM-DD hh:mm:ss" (date AND time comparison), or you can use $SP().toSPDate(new Date())
                   note: A person must be provided as "-1;#email" (e.g. "-1;#foo@bar.com") OR NT login with double \ (eg "-1;#europe\\foo_bar") OR the user ID as a number
                   note SP2013: If "-1;#" doesn't work on Sharepoint 2013, then try with "i:0#.w|" (e.g. "i:0#.w|europe\\foo_bar") ("i:0#.w|" may vary based on your authentification system -- see https://social.technet.microsoft.com/wiki/contents/articles/13921.sharepoint-20102013-claims-encoding.aspx)
                   note: A lookup value must be provided as "X;#value", with X the ID of the value from the lookup list.
                         --> it should also be possible to not pass the value but only the ID, e.g.: "X;#" or the ID as a number without anything else
                   note: A URL field must be provided as "http://www.website.com, Name"
                   note: A multiple selection must be provided as ";#choice 1;#choice 2;#", or just pass an array as the value and it will do the trick
                   note: A multiple selection of Lookup must be provided as ";#X;#Choice 1;#Y;#Choice 2;#" (with X the ID for "Choice 1", and "Y" for "Choice 2")
                         --> it should also be possible to not pass the values but only the ID, e.g.: ";#X;#;#Y;#;#"
                   note: A Yes/No checkbox must be provided as "1" (for TRUE) or "0" (for "False")
                   note: A Term / Taxonomy / Managed Metadata field must be provided as "0;#|UniqueIdentifier" for the special hidden related column (see https://github.com/Aymkdn/SharepointPlus/wiki/ to know more)
                   note: You cannot change the Approval Status when adding, you need to use the $SP().moderate function
*/

Source code: sharepointplus-5.2.js

  • Thanks for Reply @LZ_MSFT, your answer works with person field, but it's not with Attendees field. – LuisEduardox Apr 20 at 5:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.