Hello,
after using k2 events in k2 studio (change view or infopath form) and compiling I get the following error:
Compile Error: Account Review Event(Event) Line 30: Too many arguments to 'Public Function UpdateDocumentWithView(strXMLString As String, strView As String, strSerialNo As String, ProcInstID As Long, [ConnectionString As String = ""]) As String'.
Compile Error: Account Review Event(Event) Line 32: Too many arguments to 'Public Function UpdateDocumentWithView(strXMLString As String, strView As String, strSerialNo As String, ProcInstID As Long, [ConnectionString As String = ""]) As String'.
Compile Error: Account Review Event(Event) Line 36: Too many arguments to 'Public Function UpdateDocumentWithView(strXMLString As String, strView As String, strSerialNo As String, ProcInstID As Long, [ConnectionString As String = ""]) As String'.
Compile Error: Account Review Event(Event) Line 38: Too many arguments to 'Public Function UpdateDocumentWithView(strXMLString As String, strView As String, strSerialNo As String, ProcInstID As Long, [ConnectionString As String = ""]) As String'.
Considering that it comes from k2 generated code, how do I get around it?
Thanks
Page 1 / 1
Can you please post all the code of the Account Review Event? Also, which version of K2.net (SP1a, SP2a etc) are you using?
Neil,
here is the code for one of them: the version is the latest sp2
Sub Main(K2 as SourceCode.KO.ClientEventContext)
'Create the ActivityInstance of the InfoPath Document - Do not Remove this Code - InfoPath Web service relies on this data
K2.ActivityInstanceDestination.XmlFields("K2InfoPathSchema").Value = K2.ProcessInstance.XmlFields("K2InfoPathSchema").Value
SendDocURL(K2)
End Sub
Public Function SendDocURL(K2 as SourceCode.KO.ClientEventContext) As String
Dim K2SPUtil As New SourceCode.K2SPUtilities.SPSUtilities()
Dim strXMLString As String
Dim TempPath As String = ""
Dim FileURL As String
Dim FileName As String = ""
Dim i,j As Integer
Dim strView As String = "CEO Approval"
Dim strProcessName As String = K2.ProcessInstance.Process.Name
Dim strActivityName As String = K2.ActivityInstanceDestination.ActivityInstance.Activity.Name
Dim oXMLFields As SourceCode.KO.XmlFields = K2.ProcessInstance.XmlFields
Dim sDestUserFQN As String = K2.ActivityInstanceDestination.User.FQN
Dim sDestUserManagerFQN As String = K2.ActivityInstanceDestination.User.Manager
If FileName = "" Then
FileName = K2.Event.Name & "." & K2.SerialNumber.Replace(",","_") & ".xml"
Else
If Right(FileName,4).ToLower <> ".xml" Then
FileName = FileName & ".xml"
End If
End If
For i = 0 To oXMLFields.Count - 1
If oXMLFields.Item(i).Name = "K2InfoPathSchema" Then
If(IsNothing(K2.ProcessInstance.XmlFields.Item(i).Value))OrElse(K2.ProcessInstance.XmlFields.Item(i).Value.ToString().Trim = "") then
If K2.ProcessInstance.DataFields("K2DisableSubmitButton").Value = True Then
strXMLString = K2SPUtil.UpdateDocumentWithView(K2.ProcessInstance.XmlFields.Item(i).MetaData, strView,K2.SerialNumber, K2.ProcessInstance.ID,"",sDestUserFQN & "," & sDestUserManagerFQN,K2.ProcessInstance.DataFields("K2ShowViewFlowLink").Value,K2.ProcessInstance.DataFields("K2UseCachedViewFlowData").Value)
Else
strXMLString = K2SPUtil.UpdateDocumentWithView(K2.ProcessInstance.XmlFields.Item(i).MetaData, strView,K2.SerialNumber, K2.ProcessInstance.ID,"","",K2.ProcessInstance.DataFields("K2ShowViewFlowLink").Value,K2.ProcessInstance.DataFields("K2UseCachedViewFlowData").Value)
End If
Else
If K2.ProcessInstance.DataFields("K2DisableSubmitButton").Value = True Then
strXMLString = K2SPUtil.UpdateDocumentWithView(K2.ProcessInstance.XmlFields.Item(i).Value, strView,K2.SerialNumber, K2.ProcessInstance.ID,"",sDestUserFQN & "," & sDestUserManagerFQN,K2.ProcessInstance.DataFields("K2ShowViewFlowLink").Value,K2.ProcessInstance.DataFields("K2UseCachedViewFlowData").Value)
Else
strXMLString = K2SPUtil.UpdateDocumentWithView(K2.ProcessInstance.XmlFields.Item(i).Value, strView,K2.SerialNumber, K2.ProcessInstance.ID,"","",K2.ProcessInstance.DataFields("K2ShowViewFlowLink").Value,K2.ProcessInstance.DataFields("K2UseCachedViewFlowData").Value)
End If
End If
For j = 0 To K2.ActivityInstanceDestination.XmlFields.Count
If K2.ActivityInstanceDestination.XmlFields.Item(j).Name = "K2InfoPathSchema" Then
K2.ActivityInstanceDestination.XmlFields.Item(j).Value = strXMLString
exit for
End If
Next
Exit For
End If
Next
'Begin SharePoint Integration********
Dim spsList As New K2SPSList()
Dim strWorkSpaceURL As String
Dim strDocLib As String
Dim strWorkSpaceName As String = ""
Dim strServerURL as string
Dim strPartServerURL as string
Dim oByte() As Byte
If strXMLString.Trim.Length = 0 Then
Exit Function
Else
'Read into byte array
Dim oTextEncoder As New System.Text.UTF8Encoding
oByte = oTextEncoder.GetBytes(strXMLString)
oTextEncoder = Nothing
End If
strServerURL = K2.ProcessInstance.DataFields("K2SharePointURL").MetaData & "/_vti_bin/K2SpsList.asmx"
strPartServerURL = K2.ProcessInstance.DataFields("K2SharePointURL").MetaData
If strServerURL.Trim <> "" then
spsList.URL = strServerURL
End If
spsList.Credentials = K2SPUtil.GetCredentials(strPartServerURL)
Try
If K2.ProcessInstance.DataFields.Item("K2CreateNewWS").Value = True then
If K2.ProcessInstance.DataFields.Item("K2DWSName").MetaData.Trim.Length > 0 then
strWorkSpaceName = K2.ProcessInstance.DataFields.Item("K2DWSName").MetaData & "/" & K2.ProcessInstance.DataFields.Item("K2DWSName").Value
Else
strWorkSpaceName = K2.ProcessInstance.DataFields.Item("K2DWSName").Value
End If
Else
strWorkSpaceName = K2.ProcessInstance.DataFields.Item("K2DWSName").Value
End If
strWorkSpaceURL = K2.ProcessInstance.DataFields("K2DWSPath").Value
Catch
strWorkSpaceName = ""
strWorkSpaceURL = ""
End Try
strDocLib = K2.ActivityInstanceDestination.DataFields.Item("DocFolder").Value
If right(strWorkSpaceURL,1) <> "/" Then
strWorkSpaceURL += "/"
End If
If right(strDocLib ,1) <> "/" Then
strDocLib += "/"
End If
Dim ret As Boolean, errMess As String
FileURL = strWorkSpaceURL + strDocLib + FileName
If spsList.UploadDocumentFromUrl(strWorkSpaceName, FileURL, oByte, True, errMess) then
'Update the Activity Fields for Cleanup purposes
K2.ActivityInstanceDestination.DataFields("SPFileURL").Value = FileURL
K2.ActivityInstanceDestination.DataFields("SPFileSite").Value = strWorkSpaceName
Else
Throw New System.Exception(errMess)
End If
oByte = Nothing
'End SharePoint Integration********
FileURL = System.Web.HttpUtility.UrlPathEncode(FileURL)
K2.AddWorklist("ASP",FileURL)
End Function
here is the code for one of them: the version is the latest sp2
Sub Main(K2 as SourceCode.KO.ClientEventContext)
'Create the ActivityInstance of the InfoPath Document - Do not Remove this Code - InfoPath Web service relies on this data
K2.ActivityInstanceDestination.XmlFields("K2InfoPathSchema").Value = K2.ProcessInstance.XmlFields("K2InfoPathSchema").Value
SendDocURL(K2)
End Sub
Public Function SendDocURL(K2 as SourceCode.KO.ClientEventContext) As String
Dim K2SPUtil As New SourceCode.K2SPUtilities.SPSUtilities()
Dim strXMLString As String
Dim TempPath As String = ""
Dim FileURL As String
Dim FileName As String = ""
Dim i,j As Integer
Dim strView As String = "CEO Approval"
Dim strProcessName As String = K2.ProcessInstance.Process.Name
Dim strActivityName As String = K2.ActivityInstanceDestination.ActivityInstance.Activity.Name
Dim oXMLFields As SourceCode.KO.XmlFields = K2.ProcessInstance.XmlFields
Dim sDestUserFQN As String = K2.ActivityInstanceDestination.User.FQN
Dim sDestUserManagerFQN As String = K2.ActivityInstanceDestination.User.Manager
If FileName = "" Then
FileName = K2.Event.Name & "." & K2.SerialNumber.Replace(",","_") & ".xml"
Else
If Right(FileName,4).ToLower <> ".xml" Then
FileName = FileName & ".xml"
End If
End If
For i = 0 To oXMLFields.Count - 1
If oXMLFields.Item(i).Name = "K2InfoPathSchema" Then
If(IsNothing(K2.ProcessInstance.XmlFields.Item(i).Value))OrElse(K2.ProcessInstance.XmlFields.Item(i).Value.ToString().Trim = "") then
If K2.ProcessInstance.DataFields("K2DisableSubmitButton").Value = True Then
strXMLString = K2SPUtil.UpdateDocumentWithView(K2.ProcessInstance.XmlFields.Item(i).MetaData, strView,K2.SerialNumber, K2.ProcessInstance.ID,"",sDestUserFQN & "," & sDestUserManagerFQN,K2.ProcessInstance.DataFields("K2ShowViewFlowLink").Value,K2.ProcessInstance.DataFields("K2UseCachedViewFlowData").Value)
Else
strXMLString = K2SPUtil.UpdateDocumentWithView(K2.ProcessInstance.XmlFields.Item(i).MetaData, strView,K2.SerialNumber, K2.ProcessInstance.ID,"","",K2.ProcessInstance.DataFields("K2ShowViewFlowLink").Value,K2.ProcessInstance.DataFields("K2UseCachedViewFlowData").Value)
End If
Else
If K2.ProcessInstance.DataFields("K2DisableSubmitButton").Value = True Then
strXMLString = K2SPUtil.UpdateDocumentWithView(K2.ProcessInstance.XmlFields.Item(i).Value, strView,K2.SerialNumber, K2.ProcessInstance.ID,"",sDestUserFQN & "," & sDestUserManagerFQN,K2.ProcessInstance.DataFields("K2ShowViewFlowLink").Value,K2.ProcessInstance.DataFields("K2UseCachedViewFlowData").Value)
Else
strXMLString = K2SPUtil.UpdateDocumentWithView(K2.ProcessInstance.XmlFields.Item(i).Value, strView,K2.SerialNumber, K2.ProcessInstance.ID,"","",K2.ProcessInstance.DataFields("K2ShowViewFlowLink").Value,K2.ProcessInstance.DataFields("K2UseCachedViewFlowData").Value)
End If
End If
For j = 0 To K2.ActivityInstanceDestination.XmlFields.Count
If K2.ActivityInstanceDestination.XmlFields.Item(j).Name = "K2InfoPathSchema" Then
K2.ActivityInstanceDestination.XmlFields.Item(j).Value = strXMLString
exit for
End If
Next
Exit For
End If
Next
'Begin SharePoint Integration********
Dim spsList As New K2SPSList()
Dim strWorkSpaceURL As String
Dim strDocLib As String
Dim strWorkSpaceName As String = ""
Dim strServerURL as string
Dim strPartServerURL as string
Dim oByte() As Byte
If strXMLString.Trim.Length = 0 Then
Exit Function
Else
'Read into byte array
Dim oTextEncoder As New System.Text.UTF8Encoding
oByte = oTextEncoder.GetBytes(strXMLString)
oTextEncoder = Nothing
End If
strServerURL = K2.ProcessInstance.DataFields("K2SharePointURL").MetaData & "/_vti_bin/K2SpsList.asmx"
strPartServerURL = K2.ProcessInstance.DataFields("K2SharePointURL").MetaData
If strServerURL.Trim <> "" then
spsList.URL = strServerURL
End If
spsList.Credentials = K2SPUtil.GetCredentials(strPartServerURL)
Try
If K2.ProcessInstance.DataFields.Item("K2CreateNewWS").Value = True then
If K2.ProcessInstance.DataFields.Item("K2DWSName").MetaData.Trim.Length > 0 then
strWorkSpaceName = K2.ProcessInstance.DataFields.Item("K2DWSName").MetaData & "/" & K2.ProcessInstance.DataFields.Item("K2DWSName").Value
Else
strWorkSpaceName = K2.ProcessInstance.DataFields.Item("K2DWSName").Value
End If
Else
strWorkSpaceName = K2.ProcessInstance.DataFields.Item("K2DWSName").Value
End If
strWorkSpaceURL = K2.ProcessInstance.DataFields("K2DWSPath").Value
Catch
strWorkSpaceName = ""
strWorkSpaceURL = ""
End Try
strDocLib = K2.ActivityInstanceDestination.DataFields.Item("DocFolder").Value
If right(strWorkSpaceURL,1) <> "/" Then
strWorkSpaceURL += "/"
End If
If right(strDocLib ,1) <> "/" Then
strDocLib += "/"
End If
Dim ret As Boolean, errMess As String
FileURL = strWorkSpaceURL + strDocLib + FileName
If spsList.UploadDocumentFromUrl(strWorkSpaceName, FileURL, oByte, True, errMess) then
'Update the Activity Fields for Cleanup purposes
K2.ActivityInstanceDestination.DataFields("SPFileURL").Value = FileURL
K2.ActivityInstanceDestination.DataFields("SPFileSite").Value = strWorkSpaceName
Else
Throw New System.Exception(errMess)
End If
oByte = Nothing
'End SharePoint Integration********
FileURL = System.Web.HttpUtility.UrlPathEncode(FileURL)
K2.AddWorklist("ASP",FileURL)
End Function
In addition to that you might want to know that we added the K2.net SharePoint Portal Server Add in
(installatioin that failed Half Way).
I now uninstalled them.
(installatioin that failed Half Way).
I now uninstalled them.
I have compiled this code successfully without errors on my SP2a environment.
I *suspect* that the issue may be due to mismatched .dll file versions.
Can you verify the version number of K2SPUtilities.dll and K2InfoPath.dll on your development machine (located by defaul tin c:program filesk2.net 2003in) - for SP2a it should be 3.5140.1.0.
If this is not the issue then I'd recommend to log a support request through the portal: http://portal.k2workflow.com
I *suspect* that the issue may be due to mismatched .dll file versions.
Can you verify the version number of K2SPUtilities.dll and K2InfoPath.dll on your development machine (located by defaul tin c:program filesk2.net 2003in) - for SP2a it should be 3.5140.1.0.
If this is not the issue then I'd recommend to log a support request through the portal: http://portal.k2workflow.com
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.