Repath BIM360 Link to Local Drive

Hi all, I am being sent a bunch of BIM360 models that I need to run some data extraction on. Since I am not the author of the models I am working with them on my local computer. There are several nodes to repath links but from what I can tell they are all based on the Revit API call LoadFrom.

When trying to repath the links I get the following error. “Exception: An internal error has occurred.”

In the documentation for LoadFrom it says “This must be an absolute path for local path.” The Path Type for cloud links is “Cloud” and I do not see a way to change this via the API and it cannot be changed by hand.

If I manually repath the link to a random local file path type automatically changes from “Cloud” to “Absolute” and repathing works as exspected.

Does anyone know of a way to repath BIM360 links to a local drive?

#Based on a Nick Boyts's script.
import clr
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
import traceback

doc = DocumentManager.Instance.CurrentDBDocument

linkInstances = Autodesk.Revit.DB.FilteredElementCollector(doc).OfClass(Autodesk.Revit.DB.RevitLinkInstance)
toggle = IN[0]
folderpath = IN[1]
reloadedlinks= []
errorList = []
if toggle == True:
	for i in linkInstances:
		name = i.Name
		path = folderpath + "\\" + name
		paths = path.rsplit(' : ',2)[0]
		filepath = FilePath(paths)
		RevitLinkType=doc.GetElement(i.GetTypeId())
		try:
			RevitLinkType.LoadFrom(filepath,None)
		except Exception as e:
			errorList.append(traceback.format_exc())
			pass
		reloadedlinks.append(RevitLinkType)
if errorList:
	OUT = errorList
else:
	OUT= reloadedlinks

Thank you for any help you are able to provide,
Steven

Because of the many changes in BIM360 based API access, it’d help to know which version of Revit you are on (otherwise perfectly functioning code in 2023 might not work for your 2022 project, or vice versa).

Thanks for the reply @jacob.small. It would be great to solve it all the way back to 2018 but I understand that may not be possible (still have one straggler). Most of my current projects are in 2021 though.