How can I filter the API call dynamically passing through variable?
I am getting value in this variable through another API call:
var userid; this.props.context.msGraphClientFactory.getClient().then((client: MSGraphClient): void => { client .api('users') .filter('identities/any(c:c/id eq '+ userid) In the console I am getting this value in the filter query, instead I am not getting value of the variable "userid".
In the render function, storing the value of variable userid.
Making variable userid global by writing simply var userid; at the top where we import the library.
public render(): React.ReactElement<IReactTaskProps> { return ( <div className="cal" > {this.state.events.map((item, key) => {if(item.percentComplete != 100){ var tablerow = $("<tr>"); tablerow.append($('<td>').append("<a href=" +"https://tasks.office.com/credentinfotech.com/en-GB/Home/Planner#/plantaskboard?planId=" + item.planId + "&taskId=" + item.id + " target='_blank' >" + item.title )) tablerow.append($('<td>').append((() => { switch (item.percentComplete) { case 0: return "Not-Started" case 50: return "In-Progress"; } })())) tablerow.append($('<td>').append(moment(item.startDateTime).format('MM/DD/YYYY '))); tablerow.append($('<td>').append(moment(item.dueDateTime).format('MM/DD/YYYY'))); //here I am storing the value in the variable userid userid = item.createdBy.user.id; console.log(userid); tablerow.append($('<td>').append(profilename)) $("#tbody").append(tablerow); }} ) } </table> </div> </div> ); } 