Retrieve List-Artikel mit CSOM auf SharePoint Online funktioniert nicht
Frage
Ich bin seit ein paar Tagen auf diesem Problem festgefahren, Ich entwickle App-Modell auf SharePoint Online mit dem Hosted Model von Provider.
Von ClientWebPART möchte ich auf den Akten des SharePoint-Listen aufrufen. Ich kann auf Listenobjekt zugreifen, kann aber nicht den Listenelement erhalten (immer leer abrufen).
Ich folge bereits den Beispielcode in "Apps for SharePoint Sample Pack - SharePoint 2013 Durchführen von grundlegenden Datenzugriffsvorgängen mithilfe von CSOM in Apps", funktioniert jedoch immer noch nicht.
Hier sind mein Code: generasacodicetagpre.
Gibt es einen triven Fehler, den ich vermisse?
Vielen Dank im Voraus
edit: Ich erstelle neues neues Projekt und folge Anweisungen von WieSo erstellen Sie eine grundlegende Anbieter-Hosted-App für SharePoint , und verknüpft Code für das Abrufen der Listeneinzelteile, aber dennoch 0 Element zurückgeben.
Hat jemand jemals gelingt, das zu erreichen?
Lösung 2
Its working now,
its because we must add specific permission for the app at file AppManifest.xml
I add "List" at scope and give it permission "FullControl"
Andere Tipps
you can use this code to retrive the items from MSDN:
// Starting with ClientContext, the constructor requires a URL to the
// server running SharePoint.
ClientContext context = new ClientContext("http:SiteUrl");
// Assume the web has a list named "Announcements".
List announcementsList = context.Web.Lists.GetByTitle("Announcements");
// This creates a CamlQuery that has a RowLimit of 100, and also specifies Scope="RecursiveAll"
// so that it grabs all list items, regardless of the folder they are in.
CamlQuery query = CamlQuery.CreateAllItemsQuery(100);
ListItemCollection items = announcementsList.GetItems(query);
// Retrieve all items in the ListItemCollection from List.GetItems(Query).
context.Load(items);
context.ExecuteQuery();
foreach (ListItem listItem in items)
{
// We have all the list item data. For example, Title.
label1.Text = label1.Text + ", " + listItem["Title"];
}
I think issue is in your Caml Query, Just check removing Every condition from it i.e Where and also , if data is coming. After that you could cross-check your Query..