Archive for the ‘Reminders’ Category

SqlServer : Saving changes is not permitted

With SqlServer, when you want to change the structure of a table, you may encounter the following warning message :
“Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can’t be re-created or enabled the option Prevent [...]

More »

Get the parent Folder for a SPListItem

To retrieve the parent folder
my extension method

public static SPFolder GetParentFolder(this SPListItem spListItem)

{

if (spListItem == null)

return null;

SPFile spFile = spListItem.Web.GetFile(spListItem.Url);

if (spFile == null)

return null;

return spFile.ParentFolder;

}

Use

SPFolder parentFolder = sPListItem.GetParentFolder();

if (parentFolder != null)

{

// do some stuffs..

}

public static SPFolder GetParentFolder(this SPListItem spListItem)
{
if (spListItem == null)
return null;
SPFile spFile = spListItem.Web.GetFile(spListItem.Url);
if (spFile == null)
return null;
return spFile.ParentFolder;
}[/csharp]

More »