CodeDocu.com

 

 

With the following React code you can find an item from a list in SharePoint and then evaluate it

 

The underlying code is

 

 const response = await this.context.spHttpClient.get("https://mySite.SharePoint.com/_api/web/lists/GetByTitle('myList')/Items?$filter=ID eq '123'&$top=1“SPHttpClient.configurations.v1);

 

 

Then you get the following 1-line  Ein trag of anarray back

SharePoint Code: Get ListItem by Code

 

Call method:

The call can be executed using a method like this

 

var p = await  this.GetListItem("MySharePointListname","ID",123,"eq"1 );    

        if(p.value[0].Pers_x00f6_nlich==true)

        {

            return true;

        }

        return false;

 

 

this method then returns the ListItem

 

public async GetListItem(listNamestringfilterFieldNamestringfilterFieldValuestringcomparatorstringtopnumberrootbasedboolean = true): Promise<any> {

        var apiUrlstring;

        if (!rootbased) {

            apiUrl = this.context.pageContext.web.absoluteUrl;

        }

        else {

            apiUrl = this._baseUrl;

        }

 

        const response = await this.context.spHttpClient.get(apiUrl +

            "/_api/web/lists/GetByTitle('" + listName + "')/Items?$filter=" + filterFieldName + " " + comparator + " '" + filterFieldValue + "'&$top=" + topSPHttpClient.configurations.v1);

 

        return response.json();

    }

 

 

Im Visual Studio Code

Debugger : eines ListItems in SharePoint

SharePoint Code: Get ListItem by Code


Software Entwicklung Stuttgart NĂ¼rtingen
Suche Projekte C#, WPF, Windows App,ASP.Net, vb.Net, WinForms, SQL Server, Access, Excel