Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Get and Post data from Sharepoint list column with "Person" data type - spHttpClient

$
0
0
Hi,

I have a Sharepoint list named "Master" where I have three columns with the following data types:
  1. Title - Single line text
  2. MasterId - Single line text
  3. Requester - Person
https://pastebin.com/raw/Sfpd3DxW - is what my code is (hosted in pastebin for easy access and to reduce the length of this email). 

My purpose is to get the details of the Request in the list, but it is being displayed as "undefined"



so I tried tweaking the definition of "Master" interface as below:
export interface Master {  Title: string;  Id: string;  MasterId: string;  Requester: {    Email: string;  };

}


and the list printing part as below, expecting to get atleast the email address of the person:
private _renderList(items: Master[]): void {

let html: string = '';

items.forEach((item: Master) => {  html += `<ul>  <li><span class="ms-font-l">${item.Title}</span><ol>  <li>${item.MasterId}</li>  <li>${item.Title}</li>  <li>${item.Requester.Email}</li></ol>  </li></ul>`;

});


But now, I am getting an error. Can you help me to solve this problem.

Question 2:
I need to send a post request to save new row to the same list, here also I don't know how to get the current user to the person data type. Please assist me on that too.

Best Regards,
Isham Mohamed


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>