You are viewing limited content. For full access, please sign in.

Question

Question

"How to create user attributes using SDK"

SDK
asked on December 11, 2014

Hello,

 

I have a scanning station (Named Device) and need to make sure that everyone who uses it has the same Image Processing options selected.

 

One option is to set the attributes to Everyone group, but I noticed that if any user deletes the image processes for her/his specific acount, the Everyone setup will not apply.

 

So I want to do it using SDK.

I know how to add the Attributes values for an existing attribute:

 

Dim TargetAttributeName As String
TargetAttributeName = "[Scanning-" & UCase(WUserName) & "]Processes"

If account.HasAttribute(TargetAttributeName) = True Then
     account.Attribute(TargetAttributeName) = NewAttributeValue
     account.Update()
     Exit Sub
Else
     MsgBox("User does not have this Attribute.")
End If

 

My problem is when the user does not have the specific attribute, so i need to create it by code before being able to assign its value.

 

But I couldn't find the way to do it.

 

So, could anyone share the procedure to create a new attribute to a user, in case it does not exist?

 

Thank you in advance and best regards,

 

Ignacio PdeA

BMB sal

1 0

Replies

replied on December 11, 2014

Try:

TrusteeAttributeCollection attributes = Trustee.GetAttributes(
    new AccountReference(userName, session), session);
attributes["AttributeName"] = "value goes here";
attributes.Save();

 

1 0
replied on September 29, 2015

The above seems to be for Repository.Access.

 

Here you have what it worked for me in LFSO:

I wanted to automatically set the Standard Scanning interface for the user admin:

Dim account As LFUser = db.GetTrusteeByName("admin")
Dim TargetAttributeName As String = "[Settings]ScanMode"

Dim UserAttributes As LFTrusteeAttributes
UserAttributes = db.GetTrusteeAttributesBySid(account.SID, 0)
UserAttributes.PutAttribute(TargetAttributeName, 1)
UserAttributes.Update()

 

I dont know the meaning of the value "0" in the GetTrusteeAttributes, but it worked.

 

A complementary information is found at:

https://support.laserfiche.com/GetFileRepositoryEntry.aspx?id=2410&mode=download

It contains the list of Attributes and values.

 

Hope this could help someone else.

 

Regards,

 

Ignacio PdeA

BMB sal

1 0
replied on September 29, 2015

The second parameter to GetTrusteeAttributesBySid is "MaxCacheAge".  LFSO caches user attribute data locally, and if the local copy is newer than what you indicate with that argument you get the cached version instead of making a server call.  Zero indicates that you never want cached data, so every call to that function results in a server call.

3 0
replied on September 30, 2015

Thanks Brian for your reply!

 

I couldn't notice any difference between a value = 0 and a value = 1.000.000

 

But my problem now is a different one:

 

I noticed that if the LFUser whose Attributes you are modifying is currently login to the Repository, she/he must logoff-login for the new created Attributes to apply.

 

Is there any way to apply the new attributes immediately? (i.e. without the need of logoff?)

 

Thanks again and best regards,

 

Ignacio PdeA

BMB sal

0 0
replied on September 30, 2015

Each client application will have its own policies about how long to cache user settings and how frequently to check the server for changes.  User settings are used constantly by applications (e.g. every time a user views a folder list) and making a call to the server to handle the unlikely event that another application has changed them would have a serious performance impact.

Aside from logging out and back in, there is no way to force an application to update.  Most applications will eventually check for changes made by another application.  Web Access, for instance, discards its cache every 20 minutes.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.