Forum Discussion

cklapperichmn's avatar
cklapperichmn
Copper Contributor
Jul 19, 2019

Programatically accessing files shared in teams

My group has filed stored in teams channels. They're basically using excel files for data entry. I'd like to access them automatically/programatically for data analysis.

Ideally in Python, but I'm open to any language.

 

ANY solution that automatically mirrors a Teams file to a hard drive would be wonderful as an alternative. 

 

There is a REST API for 365 but it doesn't seem to provide the functionality I need based on the Microsoft.com docs, it's only for accessing files in public chat?

 

See my stack overflow post here if you want to dive into some code: https://stackoverflow.com/questions/57103597/grabbing-files-from-microsoft-teams-using-python?noredirect=1#comment100729051_57103597

6 Replies

  • Acsavag's avatar
    Acsavag
    Copper Contributor
    I found a small work around. When on a teams site, you can select sync, and if you haven't already, create a one drive folder either on your desktop or shared network site with a file path that you can access.

    For example, any time I start a new project, my script creates a new folder with sub folders for code, input, and output. I changed the pointer of that file from C:\\ to F:\\ to search and create files in the new directory that can be synced with teams.
  • Hi cklapperichmn,

     

    I hope I get your needs right. From my point of view, you just need to build a flow that copies the files from the SharePoint Online folder to another place where you can grab them? Maybe you should have a look at this option...

     

    Sven

    • hanumntha03's avatar
      hanumntha03
      Copper Contributor

      svenseidenberg 

       

      I am not able see the option which you mentioned. My requirement is also similar. I have to access all the files present in a folder (in MS Teams) and get those into PowerBI and later use them for file manipulation.

      Diagram:

       

      MS TEAMS (folder, containing files)----------------accessed by----------------------> PowerBI (containing python script).

       

      I need to access all these files using python, and the python script is in powerBI

       

      Thanks and regards.

      • christopherklapperich's avatar
        christopherklapperich
        Copper Contributor

        hanumntha03I got this working. I used the "open in sharepoint" option in teams, then used the "sync" option to sync the folder to a local folder on the hard drive. Then python could read from the local folder and the data stayed up to date. Worked well. Must have the one-drive app running on your PC.

    • cklapperichmn's avatar
      cklapperichmn
      Copper Contributor

      svenseidenbergThanks so much. You have a good grasp of my problem/needs, yp!

       

      I manged to set up a "folder sync" that moves them to a local place on my C:\ drive but a network drive would be cooler. Now people edit documents in teams and it shows up on my hard drive! I can't figure out how to change the sync to another folder. is there a way to do this?

       

      Or, any good tutorials for setting up a flow to move from Sharepoint to a network dir?

       

      Thanks.

Resources