microsoftgraph / msgraph-sdk-serviceissues

Tracks service issues for follow up.
5 stars 0 forks source link

Add a document library tab in teams, not working #71

Open kiefergrylls opened 5 years ago

kiefergrylls commented 5 years ago

Please provide the following (and please check them off the list with [x]) before submitting this issue:

Expected behavior

According to the Graph Doc https://docs.microsoft.com/en-us/graph/teams-configuring-builtin-tabs#document-library-tabs, I should be able to add a Document Library tab with this kind of JSON:

{
    "displayName": "Document%20Library1",
    "teamsApp@odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/com.microsoft.teamspace.tab.files.sharepoint",
    "configuration": {
        "entityId": "",
        "contentUrl": "https://microsoft.sharepoint.com/teams/WWWtest/Shared%20Documents",
        "removeUrl": null,
        "websiteUrl": null
    }
}

So, using the .net sdk, like this:

var tab = new TeamsTab()
                {
                    DisplayName = "LibraryTabTest",
                    AdditionalData = new Dictionary<string, object>()
                {
                   { "teamsApp@odata.bind", "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/com.microsoft.teamspace.tab.files.sharepoint" }
                },
                    Configuration = new TeamsTabConfiguration()
                    {
                        EntityId = "",
                        ContentUrl = "https://mySharepointSiteUrl/LibraryTest"
                        RemoveUrl = null,
                        WebsiteUrl = null
                    }
                };

And then using the graphClient to execute the request: graphClient.Teams[teamId].Channels[channelId].Tabs.Request().AddAsync(tab);

This should create a Tab in a channel, pointing on the SharePoint library of the SharePoint site. The request answer should be the JSON representation of the TeamsTab added.

Actual behavior

The request returns an error:

{ "error": { "code": "GeneralException", "message": "Object reference not set to an instance of an object.", "innerError": { "request-id": "3289b30c-0ce0-4727-be96-8e8f632a04f5", "date": "2019-03-04T11:28:04" } } }

What I don't understand is that the request works very well with the creation of, for example, a Wiki tab or a basic Web tab (by changing the teamsApp@odata.bind field and adapting the Configuration object following the Graph docs)

Steps to reproduce the behavior

I'm using Microsoft.Graph v1.13.0 and Microsoft.Graph.Core v1.13.0 installed from NuGet. Using an application authentication to Graph Api. Just use the code I added in the expected behaviour part.

AB#7322

MIchaelMainer commented 5 years ago

This appears to be a service issue since you can use this request to create other tabs. @nkramer do you have information on this scenario?

phillipharding commented 5 years ago

Today I tried adding a Document Library tab to a Team Channel using the v1.0 and beta endpoints using the request body below - creating Tabs of other kinds (Stream, Forms, Site etc) works fine.

{
  "displayName": "Document%20Library%20Tab",
  "teamsApp@odata.bind" : "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/com.microsoft.teamspace.tab.files.sharepoint",
  "configuration": {
    "entityId": null,         // also tried "" instead of null
    "contentUrl": "https://tenant.sharepoint.com/sites/site/doclib",
    "removeUrl": null,
    "websiteUrl": null
  }
}

Which returns a GeneralException response

{
    "error": {
        "code": "GeneralException",
        "message": "Object reference not set to an instance of an object.",
        "innerError": {
            "request-id": "request guid",
            "date": "2019-03-13T12:28:04"
        }
    }
}
nkramer commented 5 years ago

Sounds like same issue as https://github.com/microsoftgraph/microsoft-graph-docs/issues/4005#issuecomment-472407510

Imari91 commented 5 years ago

image

This was driving me nuts. As mentioned above, the service is working for any other kind of tabs, but not for document librarys when using ActiveDirectoryOAuth authentication. I have tested directly in the Graph Explorer with my User account, and it does work. Any update?

hadness commented 5 years ago

I confirm also that this is still not working with AppPermission.

FOR INFORMATION : with Delegated Permission it works for me (from ms Flow)

kiefergrylls commented 5 years ago

Any news on Microsoft side ?

phillipharding commented 5 years ago

@nkramer is there any progress on this issue?

CloudDesignBox commented 5 years ago

We are getting this issue too. I'll post on twitter to get MS attention.

phillipharding commented 5 years ago

Thanks @nkramer Adding a SharePoint Document Library Tab via an App-Only access token confirmed working today on the v1.0 and beta endpoints.

CloudDesignBox commented 5 years ago

Anyone having issues with updating tabs using app permissions? Seems to work ok with delegation. Can create the tab with app permissions but not update them.

menfra commented 4 years ago

Having similar issue using the following package versions

Microsoft.Graph.Auth version=1.0.0-preview.2, 
Microsoft.Graph.Beta version=0.9.0-preview, 
Microsoft.Graph.Core version=1.18.0, 
Microsoft.Identity.Client version=4.5.1

The error says this

Code: BadRequest
Message: Value cannot be null.
Parameter name: entity
Inner error:
    AdditionalData:
    request-id: 09211d2b-ed86-4f89-8667-42f749521af1
    date: 1/17/2020 8:41:28 AM
ClientRequestId: 09211d2b-ed86-4f89-8667-42f749521af1

Is there something I am missing, or the service issue isn't yet resolved by MS.

captinhdy commented 4 years ago

I am receiving the value cannot be null error when trying to add a website tab. I was able to add SharePoint Library tab. My website tab is created, but corrupts the tab collection or the tab after it is created and I cannot add another tab or update any tabs.

ServiceException: Code: BadRequest Message: Value cannot be null. Parameter name: entity Inner error: AdditionalData: date: 2020-07-02T22:01:39 request-id: 6238a6b9-28b2-49b9-98c9-d2428bb6d01c ClientRequestId: 6238a6b9-28b2-49b9-98c9-d2428bb6d01c


var apps = await GraphClient.Teams[teamsId].InstalledApps.Request().Expand("TeamsApp").GetAsync();
TeamsApp app = apps.Where(w => w.TeamsApp.DisplayName == "Website").Select(s => s.TeamsApp).FirstOrDefault();
app.ExternalId = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/com.microsoft.teamspace.tab.web";

TeamsTab newTab = new TeamsTab()
{
    ODataBind = "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/com.microsoft.teamspace.tab.web",
    ODataType = "microsoft.graph.teamsTab",
    TeamsApp = app,
    DisplayName = "Pending Financials",
    Configuration = new TeamsTabConfiguration()
    {  
          ContentUrl=siteUrl,
          WebsiteUrl = siteUrl,
          EntityId = null,
          ODataType= "microsoft.graph.teamsTabConfiguration",
          RemoveUrl = null
     }
};
await GraphClient.Teams[teamsId].Channels[ChannelId].Tabs.Request().AddAsync(Tab);
petrhollayms commented 7 months ago

Thank you for reporting this issue. This appears to be an issue or limitation with the service APIs. Unfortunately, as the Microsoft Graph SDK team, we do not have ownership of the APIs that are causing you issues. We invite you to create a question about the service API to Microsoft Q&A and tagged with one of the [microsoft-graph-*] tags, that way it will get routed to the appropriate team for them to triage:

https://aka.ms/msgraphsupport or directly https://aka.ms/askgraph

For now, we will close the issue on our side but feel free to open it in the relevant repository if you think the issue is specific to SDK. Please let us know if this helps!

Note: We will close this repository on April 19, 2024.