title: R scripting: BIM360 metadata to PowerBi via Forge
body: <p>Currently I have revit files on BIM360 and I am trying to get the metadata into PowerBi. I ran into this code on how to do it but I have some questions that maybe someone can answer them. Currently it appears that the metadata being pulled is from model properties and I need to the metadata from the sheet properties. the code below shows which fields are being pulled:</p>
  <pre><code>#######################################################################
  ## This R script is a sample code that demonstrate how to extract documents' data from a BIM 360 Docs project using Autodesk Forge APIs.
  #####################################################################
  
  # Define Forge App Client ID and Secret, BIM 360 Account ID, and Project ID
  App_Client_ID &lt;- &quot;&quot;
  App_Client_Secret &lt;- &quot;&quot;
  BIM360_Account_ID &lt;- &quot;&quot;
  BIM360Docs_Project_ID &lt;- &quot;&quot;
  
  
  #Load libraries required for the R script
  library(httr)
  library(jsonlite)
  
  
  #Define a function that loops through BIM 360 Docs folder structure to build a document list 
  Parse_Folder &lt;- function(folder_id, folder_name){
    Get_Folder_Content_URL &lt;- paste(&quot;https://developer.api.autodesk.com/data/v1/projects/b.&quot;,
                                    BIM360Docs_Project_ID,
                                    &quot;/folders/&quot;,
                                    folder_id,
                                    &quot;/contents&quot;, sep=&quot;&quot;)
    Get_Folder_Content_Request &lt;- GET(Get_Folder_Content_URL, add_headers(&quot;Authorization&quot; = Access_Token))
    Get_Folder_Content_Data &lt;- jsonlite::fromJSON(content(Get_Folder_Content_Request, &quot;text&quot;, &quot;application/json&quot;, &quot;UTF-8&quot;))
    Folder_Content_Files &lt;- flatten(data.frame(Get_Folder_Content_Data[&quot;included&quot;]))
    
    if (nrow(Folder_Content_Files) != 0){
      Folder_Content_Files$document.location &lt;- rep(folder_name, nrow(Folder_Content_Files))
      Folder_Content_Files_SelectedColumns &lt;- as.data.frame(Folder_Content_Files[, c(&quot;document.location&quot;,
                                                                                     &quot;included.attributes.displayName&quot;,
                                                                                     &quot;included.attributes.createUserName&quot;,
                                                                                     &quot;included.attributes.createUserId&quot;,
                                                                                     &quot;included.attributes.lastModifiedUserName&quot;,
                                                                                     &quot;included.attributes.lastModifiedUserId&quot;,
                                                                                     &quot;included.attributes.versionNumber&quot;,
                                                                                     &quot;included.attributes.fileType&quot;,
                                                                                     &quot;included.attributes.extension.type&quot;,
                                                                                     &quot;included.attributes.createTime&quot;,
                                                                                     &quot;included.attributes.lastModifiedTime&quot;,
                                                                                     
      )])
      
      BIM360Docs_Document_List &lt;- rbind(BIM360Docs_Document_List, Folder_Content_Files_SelectedColumns)
      assign(&quot;BIM360Docs_Document_List&quot;, BIM360Docs_Document_List, envir = .GlobalEnv)
    }
    
    Folder_Content_Data &lt;- flatten(data.frame(Get_Folder_Content_Data[&quot;data&quot;]))
    if (nrow(Folder_Content_Data) != 0){
      for(i in 1:nrow(Folder_Content_Data)){
        if(Folder_Content_Data[i,&quot;data.type&quot;]==&quot;folders&quot;){
          tryCatch({
            Parse_Folder(Folder_Content_Data[i,&quot;data.id&quot;], paste(folder_name, &quot;/&quot;, Folder_Content_Data[i,&quot;data.attributes.displayName&quot;], sep=&quot;&quot;))
          }, error=function(e){})
        }
      }
    }
  }
  
  
  #Use Forge Authentication API to get access token
  App_Authenticate &lt;- POST(&quot;https://developer.api.autodesk.com/authentication/v1/authenticate&quot;,
                           add_headers(&quot;Content-Type&quot; = &quot;application/x-www-form-urlencoded&quot;),
                           body=I(list(client_id = App_Client_ID,
                                       client_secret = App_Client_Secret,
                                       grant_type = &quot;client_credentials&quot;,
                                       &quot;scope&quot; = &quot;data:read&quot;)),
                           encode = &quot;form&quot;)
  Access_Token &lt;- paste(&quot;Bearer&quot;, content(App_Authenticate)$access_token,  sep=&quot; &quot;)
  
  
  #Use Forge Data Managment API to Access Top Folders in the project
  Get_Top_Folders_URL &lt;- paste(&quot;https://developer.api.autodesk.com/project/v1/hubs/b.&quot;,
                               BIM360_Account_ID,
                               &quot;/projects/b.&quot;,
                               BIM360Docs_Project_ID,
                               &quot;/topFolders&quot;, sep=&quot;&quot;)
  Get_Top_Folders_Request &lt;- GET(Get_Top_Folders_URL, add_headers(&quot;Authorization&quot; = Access_Token))
  Get_Top_Folders_Data &lt;- jsonlite::fromJSON(content(Get_Top_Folders_Request, &quot;text&quot;, &quot;application/json&quot;, &quot;UTF-8&quot;))
  TopFolders_Content &lt;- flatten(data.frame(Get_Top_Folders_Data))
  BIM360Docs_Document_List &lt;- data.frame(Date=as.Date(character()), File=character(), User=character(), stringsAsFactors=FALSE) 
  
  for(i in 1:nrow(TopFolders_Content)){
    TopFolderName &lt;- TopFolders_Content[i,&quot;data.attributes.displayName&quot;]
    if (TopFolderName != &quot;ProjectTb&quot; &amp;&amp; TopFolderName != &quot;Photos&quot; &amp;&amp; TopFolderName != &quot;Recycle Bin&quot; ){
      tryCatch({
        Parse_Folder(TopFolders_Content[i,&quot;data.id&quot;], TopFolderName)
      }, error=function(e){})
    }
  }
  
  names(BIM360Docs_Document_List)[names(BIM360Docs_Document_List)==&quot;document.location&quot;] &lt;- &quot;Document Location&quot;
  names(BIM360Docs_Document_List)[names(BIM360Docs_Document_List)==&quot;included.attributes.displayName&quot;] &lt;- &quot;File Name&quot;
  names(BIM360Docs_Document_List)[names(BIM360Docs_Document_List)==&quot;included.attributes.createUserName&quot;] &lt;- &quot;Created by&quot;
  names(BIM360Docs_Document_List)[names(BIM360Docs_Document_List)==&quot;included.attributes.createUserId&quot;] &lt;- &quot;Created by (ID)&quot;
  names(BIM360Docs_Document_List)[names(BIM360Docs_Document_List)==&quot;included.attributes.lastModifiedUserName&quot;] &lt;- &quot;Updated by&quot;
  names(BIM360Docs_Document_List)[names(BIM360Docs_Document_List)==&quot;included.attributes.lastModifiedUserId&quot;] &lt;- &quot;Updated by (ID)&quot;
  names(BIM360Docs_Document_List)[names(BIM360Docs_Document_List)==&quot;included.attributes.versionNumber&quot;] &lt;- &quot;Version&quot;
  names(BIM360Docs_Document_List)[names(BIM360Docs_Document_List)==&quot;included.attributes.fileType&quot;] &lt;- &quot;File Type&quot;
  names(BIM360Docs_Document_List)[names(BIM360Docs_Document_List)==&quot;included.attributes.extension.type&quot;] &lt;- &quot;Extension Type&quot;
  names(BIM360Docs_Document_List)[names(BIM360Docs_Document_List)==&quot;included.attributes.createTime&quot;] &lt;- &quot;Created Date&quot;
  names(BIM360Docs_Document_List)[names(BIM360Docs_Document_List)==&quot;included.attributes.lastModifiedTime&quot;] &lt;- &quot;Updated Date&quot;
  
  
  # Clear Variables
  rm(i, Access_Token,
     App_Client_ID,
     App_Client_Secret,
     App_Authenticate,
     BIM360_Account_ID,
     BIM360Docs_Project_ID,
     Get_Top_Folders_URL, 
     Get_Top_Folders_Request,
     Get_Top_Folders_Data,
     TopFolders_Content,
     TopFolderName,
     Parse_Folder
  )
  </code></pre>
  <p>My question is can I use this to get into the Revit file and get the sheet properties? If so how did was the name &quot;versionNumber&quot; in <code>include.attribute.versionNumber</code> decided? Is this how the package in R script predetermines it or is this how the name on the server side appears?</p>
  <p>Thank you so much in advance and I'm sorry if I don't have the correct etiquette down packed.</p>