Hello,
I have an workflow where I want to iterate a list after a delay.
SPWeb thisWeb = Context.Web; SPList list = thisWeb.Lists["ListeExt"]; SPListItemCollection items = list.GetItems(); foreach (SPListItem item in items) { ..... }
Where Context is the context obtain by applyActivation. First time if I iterate the List before the delay it works but after the delay get an error.
However thisWeb, list and items instances are not null. But immediately when I want to use the items object I have an error.
Further I can't see error in debug because after a delayActivity, visual Studio can't follow the execution...
I have look the log :
Area : SharePoint Foundation Category : Workflow Infrastructure Level : Unexpected EventID : 98d4 Message : System.NullReferenceException: Object reference not set to an instance of an object. at AlertesDRCP.Workflow_Alertes_DRCP.Workflow_Alertes_DRCP.checkAlertes_ExecuteCode(Object sender, EventArgs e)at System.Workflow.ComponentModel.Activity.RaiseEvent(DependencyProperty dependencyEvent, Object sender, EventArgs e) at System.Workflow.Activities.CodeActivity.Execute(ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext)at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime) at System.Workflow.Runtime.Scheduler.Run()
But when I check item is not null...
Example this code has error :
if(items != null) { int nb = items.Count; }
EDIT:
I have forget to specify that my List is an External List. I have found an other error message like this :
Microsoft.SharePoint.SPException: Access denied by business Data Connectivity. ---> Access Denied for User '', which may be an impersonation by 'CFM\spfarm'. Securable MethodInstance with Name 'ReadList'denied access.I think after delay the authentification with the BDC is lost...
ideas ?
Thank you.