Beispiel #1
0
        public async Task <List <string> > GetRevitFileVersionId(string projectId, string versionId, string userAccessToken)
        {
            string folderId = await GetFolderId(projectId, versionId, userAccessToken);

            FoldersApi folderApi = new FoldersApi();

            folderApi.Configuration.AccessToken = userAccessToken;
            dynamic contents = await folderApi.SearchFolderContentsAsync(
                projectId, folderId, 0,
                new List <string>(new string[] { "rvt" }));

            if (contents.Data.included.Count == 0)
            {
                throw new Exception("No Revit file found in folder!");
            }

            List <string> versionIds = new List <string>();

            foreach (KeyValuePair <string, dynamic> includedItem in new DynamicDictionaryItems(contents.Data.included))
            {
                if (includedItem.Value.attributes.hidden == false)
                {
                    if (includedItem.Value.relationships.tip.data.type == "versions")
                    {
                        versionIds.Add(includedItem.Value.relationships.tip.data.id);
                    }
                }
            }

            return(versionIds);
        }