Add Project Shared Parameter

Add Project Shared Parameter

yuvdal
Enthusiast Enthusiast
697 Views
4 Replies
Message 1 of 5

Add Project Shared Parameter

yuvdal
Enthusiast
Enthusiast

Hello,

 

I'm working on Add-in that help users to add specific shared parameters to their project easily (without the necessary of browse file, set group, set categories etc.)

2020-05-28_07-35-18.png 

I want to add this parameters without to change the Shered Parameters File name (SharedParametersFilename()) of the user.

As I understand the most important data for me on the Shered Parameters File is the GUID so I thought maybe I can insert the GUID for the parameter on the code.

What is the best way to do this and what is the code that I have to use?

 

Thanks,

Yuval Dolin

0 Likes
Accepted solutions (1)
698 Views
4 Replies
Replies (4)
Message 2 of 5

RPTHOMAS108
Mentor
Mentor
Accepted solution

I've not looked at this aspect for a while but I believe you are still required to go through the shared parameter file get the ExternalDefinitions set from that and add to it. The usual process is to:

 

Change path of shared parameter file to a temporary location

Add your definitions to this temporary shared parameter file

Create category bindings

Change the path of the shared parameter file back to what it was before

 

Important to do things in that order as the definitions could be garbage collected/invalid if you change the shared parameter file location before you use the definitions (that's been my experience).

 

It would be nice if there was a way of creating a shared parameter with just a GUID, parameter type and name.

Message 3 of 5

yuvdal
Enthusiast
Enthusiast

Ok, but in order to change the path of the shared parameter file back to what it was before I have to storage the file path.

What is the code to know the current shared parameter file path?

0 Likes
Message 4 of 5

lukaskohout
Advocate
Advocate

You just need to call Application.SharedParametersFilename to retrieve current shared parameters file path as string. 

 

Furthermore you can set desired path with this call.


Hitting Accepted Answer is a Community Contribution from me as well as from you.
======================================================================
0 Likes
Message 5 of 5

yuvdal
Enthusiast
Enthusiast

Great, thank you!

0 Likes