Linking Cloud Rvt Models not working on Revit 2023.1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, everyone.
I have this method on a Revit add-in that takes the ModelPaths of some newly created Revit files on an Autodesk Docs folder and then links them to the current model.
It was working fine on my machine (using Revit 2023) but when testing it with colleagues who have Revit 2023.1 a RevitServerUnauthorizedException is thrown with the message: "object reference not set to an instance of an object"
There is a snippet of when I 'm creating the links:
if (!linkExists)
{
using (Transaction tr = new Transaction(doc, "Link Building file"))
{
tr.Start();
try
{
WorksetConfiguration worksetConfiguration = new WorksetConfiguration(WorksetConfigurationOption.CloseAllWorksets);
RevitLinkOptions linkOptions = new RevitLinkOptions(false, worksetConfiguration);
LinkLoadResult linkTypeResult = RevitLinkType.Create(doc, modelPath, linkOptions);
if (LinkLoadResult.IsCodeSuccess(linkTypeResult.LoadResult))
{
linkElementId = linkTypeResult.ElementId;
}
}
catch (Exception e)
{
TaskDialog.Show("Error", "Error Linking the file: " + e.Message);
}
tr.Commit();
}
}
The exception is thrown at the RevitLinkType.Create() method.
Some things I already checked:
- The modelpahts are valid and correspond to workshared cloud models.
- The current document to host the links is also already a cloud workshared file.
- The user has access to the Autodesk Account and the project (if not, the code that creates the files on the cloud wouldn't have worked on the first place)
- I tried with my same account on the machines with the 2023.1 version and the problem persisted so it's not related to my user's permissions.
Is there any change between versions that I should be aware of? Or maybe should I use an overload of the RevitLinkType.Create() method?
Thanks in advance!