Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Empty string for Sid when using SPFile.CheckedOutByUser Sid Property

$
0
0

Hello,

Recently upgraded from 2010 to 2013 and now i'm having issues with this Infopath form. When debugging, file.CheckedOutByUser.Sid.ToString() return an empty string.

I've also check using 

PS C:\Users\FTAO> $web =Get-SPWeb http://site
PS C:\Users\FTAO> $web.SiteUsers["domain\FTAO"]

and I see Sid is being populated correctly.

I am not sure if I did something wrong during the upgrade process or if I am looking at the wrong place. Any insight on this is appreciated.

Dim file As SPFormFile = GetFile(FormUniqueID.Value)
If file.CheckOutType = SPFile.SPCheckOutType.None Then
	'***Tie in Security***
	If CurrentUserFormWriteAccess.Value = 1 Then
		CheckOutStatusText.SetValue("This Form is not checked out.")
		CanUserCheckOut.SetValue(1)
		CanUserCheckIn.SetValue(0)
	End If
ElseIf file.CheckOutType <> SPFile.SPCheckOutType.None Then
	CanUserCheckOut.SetValue(0)
	Dim filecheckoutuser As String = file.CheckedOutByUser.Sid.ToString()

	Dim filecheckoutdatetime As DateTime = file.CheckedOutDate
	If filecheckoutuser = CurrentUserSID.Value.ToString() Then
		CheckOutStatusText.SetValue("This Form is checked out to you. Checkout Date/Time: " & filecheckoutdatetime.AddHours(-5) & ".")
		CanUserCheckIn.SetValue(1)
	Else
		CheckOutStatusText.SetValue("This Form is checked out by " & file.CheckedOutByUser.Name.ToString() & ". Checkout Date/Time: " & filecheckoutdatetime.AddHours(-5) & ".")
	End If

End If


Update: Resolved the issue by using Victoria workaround.

Replaced

Dim filecheckoutuser As String = file.CheckedOutByUser.Sid.ToString()

with

Dim userLogin As String = file.CheckedOutByUser.LoginName.Substring(7)
Dim filecheckoutuser As String = SPContext.Current.Web.AllUsers(userLogin).Sid

Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>