Domanda

I'm trying to create a new List in specific Site with my own Sharepoint Application and I'm getting Access denied error when I send the request to API.

My application have Sites.ReadWrite.All, this is the permission required to do this process following documentation

I don't know what is the problem or what I'm doing wrong with this process:

Public Async Sub CreateList(siteId As String, name As String)
    Try
        Dim list As New List()

        Dim info As New ListInfo()
        info.Template = "genericList"

        Dim col As New ColumnDefinition()
        col.Name = "Code"
        col.Text = New TextColumn

        Dim coll As New ListColumnsCollectionPage
        coll.Add(col)

        list.DisplayName = name
        list.ListInfo = info
        list.Columns = coll

        Await GraphClient.Sites(siteId).Lists.Request.AddAsync(list)
    Catch ex As Exception
        Console.WriteLine(ex.Message) 'Access denied
    End Try
End Sub
È stato utile?

Soluzione

Finally, I found the issue.

I have tested different permissions with Application and granted admin consent to that new permissions and that runs perfectly without errors, so I think that Microsoft Documentation is a bit obsolete.

This procedure runs me with Sites.FullControl.All permission.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top