Skip to main content

Hi,


 I have the following situation. I have couple of sharepoint lists which have lookup columns to each other, so something like a hierarchy is built. I have a smart object which is supposed to get the data from all the lists using the leaf node as start one and present it as a single entity. The problem is that in the lookup column is returning a value like this: 1;#1 where 1 is the key of the related list and because of that I can not use the column to define the service link in the smart object and there is no way I can populate my smartobject.


 One other problem that I have is that using the wizard for the service method link I can not define the link between the service calls. I constanly receive: object reference not set to an instance of an object when I click the OK button on the link wizard page.


Please Help!!!


 

Hi


Are you using the SharePoint service object to retrieve the values from your list? You can create a SmartObject with a custom method that hooks into the SharePoint service object to retrieve a list of rows from your SharePoint list.


The '1;#1' is the way SharePoint does it's links to other columns, I've certainly seen this when using the vti_bin/lists.asmx webservice call to SharePoint. 


Your second issue object reference not set to an instance of an object is a known problem, as stated in: http://kb.k2workflow.com/articles/kb000201.aspx


Martin


10x a lot for the hotfix info. I will try to inherit the sharepoint service and try to modify it for now. One more thing I was having problem with is that the standard sharepoint service broker was giving error 401: Unable to Authenticate and after debugging it I found that the user name that was used in the credentials was K2:domainusername and this was causing the problem. I just remove the K2: for now and it is fine, but it is more like a temporary "hack", so I can continue developing the application. If anybody has some idea I will be glad to hear it. The service instance is running with the impersonation flag off and with Kerberos.

Hi lz2plm,


funnily enough i've been having same issues (on our Production server) with failure to authenticate and not being able to turn the impersonate checkbox on... If anyone out there has any suggestions to fix this, that would be great.


how did you remove the 'k2' bit of the username? According to the event viewer Security log it would seem that this is the same issue i'm having at the moment...


Martin


 


Hi,


 Here is what I'm currently doing: I have inherited the provided SharePoint service and overrided the Execute method, so I can change the user name just before the Execute method of the base class where it is using it in order to set it as credentials of the sharepoint webservice call. Basically I'm checking if the user name is in the form Group:Domainusername if if this is the case I take everything after the ':' symbol. In the same method after the execute I have some other logic that is "fixing" the lookup column value to be only the key and not 'key#;value', so I can set the service links in order to impelement my composite smartobject. So as you can see the Execute method is very helpfull to me (I'm glad that I can override it, because otherwise I was going to be in big trouble 🙂 ).


 By the way just to let you know the credentials you specify when you define the service instance are being used only for the metadata generation during the registration  and when you make the call to the service it is using the credentials of the client. I still need to confirm that but I tried to use different accounts (note: the password is stored in clear form in the metadata) and while I was debugging the service I can see that it is always using the account I'm logged in on the computer.


 I also need to add some searching capabilities as the base service only has the Load method where the ID should be passed and I have a unique column I want to search by.


Here is some sample code. The assembly of the sharepoint service is located in the usual place --> {k2 folder}ServiceBroker


public class SharePointService : SourceCode.SmartObjects.Services.SharePoint.SharePointService


{


public override void Execute()


{


string userName = this.Service.ServiceConfiguration.ServiceAuthentication.UserName;


if (userName.IndexOf(""") != -1 && userName.IndexOf(":") != -1)


userName = userName.Substring(userName.IndexOf(":") + 1);


this.Service.ServiceConfiguration.ServiceAuthentication.UserName = userName;


base.Execute();


.........................................


}


}


thanks very much for the detailed reply :-)


I wish I could fix the underlying issue here rather than modify the service object.... we have two other K2 blackpearl boxes working fine, but this particular machine where the issue lies is a distributed environment, so I guess Kerberos could be the culprit here.


I worked out that it is the current user that is passed to the service... the receiving machine appears to recognise the user, but it then does something strange and tries to use NT AUTHORITY/anonymous user which of course results in failure.


As for your search, have you tried using the GetList method? you can pass a parameter into the GetList method that will 'filter' the output of it, if you filter it using a unique column, this should result in only one row being returned. We've used it a number of times to do what you want - the only issue is effiency, but it can only be doing a select statement in the background.


Martin


Yeah, I use only the GetList method (after I confirmed that the Load one accepts only the ID which is the correct way since I don't know a way to specify a unique column in the sharepoint list definition), but after I went through the code of the sharepoint service I saw that  unfortunatelly it doesn't accept input values and has only return values. I can use the K2 data provider and set the filter which will do it again after all the data is returned but I want to use the service call from the workflow and want to just add a reference where I can provide the parameter value. For now I will use the optional method parameters in the smartobject definition and will expect one with the same name as the list column name.

Reply