I am having problems file checkins in the code below. It works fine if we are using it in a window app but when using it in our asp.net website it will not check in a file. I have tried the exact same file in the same folder using the same user permissions. Can someone help?
Using Vault 2.0.6
Public Function CheckIn(ByVal strVaultFile As String, Optional ByVal strLocalPath As String = "", Optional ByVal strComment As String = "") As ResultCode
Dim vcfile As VaultClientFile
Dim csi As ChangeSetItem
Dim csic As ChangeSetItemColl
Dim csicNew As New ChangeSetItemColl
Dim Result As ResultCode
vcfile = _ci.TreeCache.Repository.Root.FindFileRecursive(strVaultFile)
If Not (vcfile Is Nothing) Then
SetWorkingFolder(vcfile.Parent.FullPath, strLocalPath)
csic = _ci.InternalChangeSet_GetItems(True)
For Each csi In csic
If csi.DisplayRepositoryPath.ToLower = strVaultFile.ToLower Then
csicNew.Add(csi)
End If
Next
If csicNew.Count > 0 Then
Result = _ci.Commit(csicNew)
Else
If _ci.UndoCheckOut(vcfile, LocalCopyType.Leave) Then
Result = ResultCode.CheckInUnDone
End If
End If
Else
Throw New Exception(String.Format("{0} was not found in Vault.", strVaultFile))
End If
RestoreWorkingFolder(vcfile.Parent.FullPath)
Return Result
End Function
Public Function SetWorkingFolder(ByVal strVaultFolder As String, ByVal strWorkingFolder As String) As Boolean
Dim bResult As Boolean = False
Dim stackFolders As Stack
If strWorkingFolder <> "" And IO.Directory.Exists(strWorkingFolder) Then
If lstOldWorkingFolders(strVaultFolder) Is Nothing Then
stackFolders = New Stack
lstOldWorkingFolders.Add(strVaultFolder, stackFolders)
Else
stackFolders = lstOldWorkingFolders(strVaultFolder)
End If
If _ci.TreeCache.GetWorkingFolder(strVaultFolder) = "" Then
stackFolders.Push("REMOVE")
Else
stackFolders.Push(_ci.TreeCache.GetWorkingFolder(strVaultFolder))
End If
_ci.TreeCache.SetWorkingFolder(strVaultFolder, strWorkingFolder)
_ci.Refresh()
bResult = True
End If
Return bResult
End Function
Public Function RestoreWorkingFolder(ByVal strVaultFolder As String) As Boolean
Dim bResult As Boolean = False
Dim stackFolders As Stack, strOldFolder As String
stackFolders = lstOldWorkingFolders(strVaultFolder)
If Not (stackFolders Is Nothing) Then
strOldFolder = stackFolders.Pop()
If strOldFolder = "REMOVE" Then
_ci.TreeCache.RemoveWorkingFolder(strVaultFolder)
Else
_ci.TreeCache.SetWorkingFolder(strVaultFolder, strOldFolder)
End If
_ci.Refresh()
bResult = True
End If
Return bResult
End Function
Need help with file CheckIn
Moderator: SourceGear
Need help with file CheckIn
We don't think it's a permissions problem as the pages that use this code are in our intranet which is using Window Authentication for access. Also using the same login we can do all the other functions in Vault, checkout, getlatest, undo checkout, ...
Need help with file CheckIn
We have had impersonation turned on. Here are the lines from our web.config file:
<authentication mode="Windows" />
<identity impersonate="true" />
The line that is failing is:
csic = _ci.InternalChangeSet_GetItems(True)
Its returning ChangeSetItems in the Windows app and no ChangeSetItems in the web app.
Thanks for your help.
<authentication mode="Windows" />
<identity impersonate="true" />
The line that is failing is:
csic = _ci.InternalChangeSet_GetItems(True)
Its returning ChangeSetItems in the Windows app and no ChangeSetItems in the web app.
Thanks for your help.