How to share Parts from PDMLink to ProjectLink using API’s ?

How to share Parts from PDMLink to ProjectLink using API’s ?

Add Comment
1 Answer(s)

There is no Supported API’s to perform Operations involving sharing objects to project link.

below is a sample that can be used.

wt.inf.sharing.DataSharingHelper.service.createShares() 
public WTCollection createShares(WTCollection objsToShare, WTContainerRef to_container_ref, Folder to_folder, ShareKind kind, State state, boolean is_shortcut) throws WTException

Example Usage:

ObjectIdentifier oid = null;
try {
  oid = ObjectIdentifier.newObjectIdentifier("wt.part.WTPart:XXXXX");
  wt.part.WTPart record = (wt.part.WTPart) PersistenceHelper.manager.refresh(oid);
  oid = ObjectIdentifier.newObjectIdentifier("wt.projmgmt.admin.Project2:XXXX");
  WTContainerRef projRef = WTContainerRef.newWTContainerRef(oid);
  WTSet objs = new WTHashSet(1, CollectionsHelper.OBJECT_IDENTIFIER);
  objs.add(record);
  WTCollection share = DataSharingHelper.service.createShares(objs, projRef, null, ShareKind.OBJECT, null, false);
} catch(WTException e) { 
// TODO Auto-generated catch block                   
e.printStackTrace();            
}

 

Answered on February 12, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.