SOLVED

Retrieve Channel Folder with Graph API returns 502 Bad Gateway

%3CLINGO-SUB%20id%3D%22lingo-sub-1111668%22%20slang%3D%22en-US%22%3ERetrieve%20Channel%20Folder%20with%20Graph%20API%20returns%20502%20Bad%20Gateway%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1111668%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20been%20using%20this%20API%20for%20a%20little%20while%3A%3C%2FP%3E%3CPRE%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fbeta%2Fteams%2F%7Bid%7D%2Fchannels%2F%7Bid%7D%2FfilesFolder%3C%2FPRE%3E%3CP%3E%26nbsp%3BRecently%20I%20noticed%20that%20in%20some%20site%20this%20API%20will%20result%20in%20a%20Bad%20Gateway%20error.%3C%2FP%3E%3CP%3EI%20tried%20this%20in%20both%20Graph%20Explorer%20and%20my%20test%20program%2C%20at%20first%20I%20thought%26nbsp%3Bit%20was%20a%20lack%20of%20permission%20so%20I%20modified%20the%20permissions%20on%20Graph%20Explorer%20according%20to%20%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fdriveitem-get%3Fview%3Dgraph-rest-beta%26amp%3Btabs%3Dhttp%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fdriveitem-get%3Fview%3Dgraph-rest-beta%26amp%3Btabs%3Dhttp%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CTABLE%3E%3CTBODY%3E%3CTR%3E%3CTD%3EFiles.Read.All%2C%20Files.ReadWrite.All%3CBR%20%2F%3EGroup.Read.All%2C%20Group.ReadWrite.All%3CBR%20%2F%3ESites.Read.All%2C%20Sites.ReadWrite.All%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E(My%20app%20is%20using%20application%20permission)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20with%20all%20of%20these%20enabled%2C%20I%20tested%20it%20again%20on%20the%20Graph%20Explorer%2C%20and%20it%20ended%20up%20the%20same%3A%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20990px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F165587i1547FFE3E9C5FD58%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22ss1.png%22%20title%3D%22ss1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMeanwhile%20I%20found%20this%20doesn't%20happen%20on%20every%20site%2C%20in%20some%20site%20this%20API%20will%20work%20fine%20even%20without%20permission%20changes%20(previously%20it%20was%20just%26nbsp%3BFiles.ReadWrite.All%20%2B%26nbsp%3BSites.ReadWrite.All%20I%20think)%3C%2FP%3E%3CP%3ESo%20I'm%20not%20sure%20what%20is%20causing%20this%20error%2C%20is%20there%20still%20some%20permission%20I%20need%20to%20enable%2C%20or%20is%20there%20something%20special%20with%20the%20site%20I'm%20testing%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1111668%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1114238%22%20slang%3D%22en-US%22%3ERe%3A%20Retrieve%20Channel%20Folder%20with%20Graph%20API%20returns%20502%20Bad%20Gateway%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1114238%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F507316%22%20target%3D%22_blank%22%3E%40ck1521%3C%2FA%3E%2C%20Could%20you%20please%20give%20try%20to%20following%20api%20call%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fsites%2F%7Bsite-id%7D%2Fdrive%2Froot%2Fchildren%2F%26nbsp%3B%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fsites%2F%7Bsite-id%7D%2Fdrive%2Froot%2Fchildren%2F%26nbsp%3B%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1114303%22%20slang%3D%22en-US%22%3ERe%3A%20Retrieve%20Channel%20Folder%20with%20Graph%20API%20returns%20502%20Bad%20Gateway%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1114303%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F371090%22%20target%3D%22_blank%22%3E%40Trinetra-MSFT%3C%2FA%3E%26nbsp%3BThanks%20for%20your%20help.%3C%2FP%3E%3CP%3EThis%20API%20worked%20and%20it%20looks%20like%20a%20suitable%20substitute%20for%20what%20I've%20been%20trying%2C%20thanks.%3C%2FP%3E%3CP%3EJust%20one%20more%20thing%2C%20if%20the%20channel%20has%20somehow%20been%20renamed%2C%20would%20there%20be%20any%20ways%20to%20track%20it%20back%20to%20the%20original%20folder%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1151102%22%20slang%3D%22en-US%22%3ERe%3A%20Retrieve%20Channel%20Folder%20with%20Graph%20API%20returns%20502%20Bad%20Gateway%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1151102%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F371090%22%20target%3D%22_blank%22%3E%40Trinetra-MSFT%3C%2FA%3E%26nbsp%3BI%20am%20also%20having%20the%20same%20issue.%20I%20am%20trying%20to%20get%20the%20site%20url%20of%20a%20private%20channel%20and%20since%20private%20channel%20has%20separate%20site%20collection%20so%20this%20url%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fbeta%2Fgroups%2F%7Bteam-id%7D%2Fdrive%2Froot%2Fchildren%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fbeta%2Fgroups%2F%7Bteam-id%7D%2Fdrive%2Froot%2Fchildren%3C%2FA%3E%20does%20not%20provide%20the%20desired%20result.%3C%2FP%3E%3CP%3ETo%20get%20private%20channel%20site%20url%2C%20I%20am%20using%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fbeta%2Fteams%2Fgroup-id%2Fchannels%2Fprivate-channel-Id%2FfilesFolder%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fbeta%2Fteams%2Fgroup-id%2Fchannels%2Fprivate-channel-Id%2FfilesFolder%3C%2FA%3E%20but%20this%20throws%20502%20bad%20gateway%20in%20one%20tenant%20but%20in%20other%20tenant%20it%20works.%20I%20tried%20all%20possible%20ways%20to%20fix%20it%20i.e.%20by%20changing%20permissions%20to%20the%20app%20but%20it%20didn't%20work%20and%20I%20am%20stuck.%20Could%20you%20suggest%20why%20I%20am%20facing%20this%20issue%20in%20one%20tenant%20and%20is%20there%20any%20other%20way%20to%20get%20private%20channel%20site%20collection%20url%3F%3C%2FP%3E%3CP%3EPlease%20note%20that%2C%20before%20sending%20a%20request%20to%20this%20given%20url%20I%20am%20sending%20another%20request%20to%20get%20all%20private%20channels%20and%20that%20works%20in%20both%20the%20tenants%20but%20this%20one%20fails.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E-Prashant.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1459362%22%20slang%3D%22en-US%22%3ERe%3A%20Retrieve%20Channel%20Folder%20with%20Graph%20API%20returns%20502%20Bad%20Gateway%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1459362%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F6833%22%20target%3D%22_blank%22%3E%40Prashant%20Gupta%3C%2FA%3E%26nbsp%3BI'm%20having%20the%20exact%20same%20issue.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hello,

 

I've been using this API for a little while:

https://graph.microsoft.com/beta/teams/{id}/channels/{id}/filesFolder

 Recently I noticed that in some site this API will result in a Bad Gateway error.

I tried this in both Graph Explorer and my test program, at first I thought it was a lack of permission so I modified the permissions on Graph Explorer according to :

https://docs.microsoft.com/en-us/graph/api/driveitem-get?view=graph-rest-beta&tabs=http

 

Files.Read.All, Files.ReadWrite.All
Group.Read.All, Group.ReadWrite.All
Sites.Read.All, Sites.ReadWrite.All

(My app is using application permission)

 

So with all of these enabled, I tested it again on the Graph Explorer, and it ended up the same:ss1.png

 

Meanwhile I found this doesn't happen on every site, in some site this API will work fine even without permission changes (previously it was just Files.ReadWrite.All + Sites.ReadWrite.All I think)

So I'm not sure what is causing this error, is there still some permission I need to enable, or is there something special with the site I'm testing?

 

Thanks,

4 Replies
Best Response confirmed by Trinetra-MSFT (Microsoft)

@Trinetra-MSFT Thanks for your help.

This API worked and it looks like a suitable substitute for what I've been trying, thanks.

Just one more thing, if the channel has somehow been renamed, would there be any ways to track it back to the original folder?

@Trinetra-MSFT I am also having the same issue. I am trying to get the site url of a private channel and since private channel has separate site collection so this url https://graph.microsoft.com/beta/groups/{team-id}/drive/root/children does not provide the desired result.

To get private channel site url, I am using https://graph.microsoft.com/beta/teams/group-id/channels/private-channel-Id/filesFolder but this throws 502 bad gateway in one tenant but in other tenant it works. I tried all possible ways to fix it i.e. by changing permissions to the app but it didn't work and I am stuck. Could you suggest why I am facing this issue in one tenant and is there any other way to get private channel site collection url?

Please note that, before sending a request to this given url I am sending another request to get all private channels and that works in both the tenants but this one fails.

 

-Prashant.

@Prashant Gupta I'm having the exact same issue.