Hi,
I am trying to use the function User.GetUserByID in an IndexBuilderExtender. However, I the following exception:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Dynamicweb.Security
StackTrace:
at Dynamicweb.Security.UserManagement.Common.CustomFields.CustomField.GetCustomFields()
at Dynamicweb.Security.UserManagement.Common.CustomFields.CustomField.GetCustomFields(String tableName)
at Dynamicweb.Security.UserManagement.Common.CustomFields.CustomFieldValue.GetCustomFieldValuesFromContainer(String tableName, Object container)
at Dynamicweb.Security.UserManagement.User.Fill(IDataReader reader)
at Dynamicweb.Security.UserManagement.User.GetUser(CommandBuilder commandBuilder)
at Dynamicweb.Security.UserManagement.User.GetUserByID(Int32 userID, Boolean includeAngelType)
at Website.UserIndexExtender.ExtendDocument(IndexDocument indexDocument) in C:\Projects\Solutions\Website\Website\UserIndexExtender.cs:line 21
at Dynamicweb.Security.UserManagement.Indexing.UserIndexBuilder.WriteDoc(IndexDocument doc, Int64 currentAutoId)
at Dynamicweb.Security.UserManagement.Indexing.UserIndexBuilder.ProcessUsers()
at Dynamicweb.Security.UserManagement.Indexing.UserIndexBuilder.Build(IIndexWriter writer, Tracker tracker)
And I know that the user, with the ID provided, exists.
What I am specifically trying to achieve is to add a column to the index containing information about the root group of a certain user. If a user is located in group B and group B is created as a subgroup of group A, I want the ID of group A as the value of the new field. For my problem, it does not matter that a user can be attached to multiple groups. I just take the first in the list of groups.
Is there another way to achieve this?
Best regards,
Roald, Novicell