Linking Cloud Rvt Models not working on Revit 2023.1

Linking Cloud Rvt Models not working on Revit 2023.1

JulioPolo
Participant Participant
346 Views
1 Reply
Message 1 of 2

Linking Cloud Rvt Models not working on Revit 2023.1

JulioPolo
Participant
Participant

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!



0 Likes
347 Views
1 Reply
Reply (1)
Message 2 of 2

sowmiyhan
Participant
Participant

I am facing this issue in 2024 also,   

" Autodesk.Revit.Exceptions.RevitServerUnauthorizedException
HResult=0x80131500
Message=Object reference not set to an instance of an object.
Source=RevitAPI
StackTrace:
at Autodesk.Revit.DB.RevitLinkType.Create(Document document, ModelPath path, RevitLinkOptions options) "

The parameters which i pass is also valid and  it's not null. what could be the rootcause of this issue?

@jeremytammik 

0 Likes