We have a bugtracking system based on Sharepoint+Infopath technologies.

Infopath Forms have a few copies for different AD groups, so every employee can edit its own fields, depending on Active Directory user group:

image

Problem:

After stsadm export operation, “Status” field disappears. So the form has this field, but sharepoint stops to show it in list Settings and list Views.

Solution:

–  Republish Infopath form in Sharepoint Designer(column will appear, but with empty values).

– Refresh all list items. After refresh values returns to field.

You can do it programmatically by example using this code:

using (SPSite site = new SPSite("http://server/webName "))
using (SPWeb web = site.OpenWeb())
{
SPList list = web.GetList("http://server/webname/libName/");
foreach (SPListItem item in list.Items)
{
try
{
Console.Write("Updating " + item.ID.ToString());
item.SystemUpdate();
Console.WriteLine(".. Ok.");
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
}

or if You prefer Powershell:

$web = Get-SPWeb -identity "http://server/webName"
$list = $web.Lists["listName"]
$list.Items | ForEach-Object { Write-Host "Updating " $_.Name; $_.SystemUpdate(); }
$web.Dispose()

p.s.: If there were some User Views that used the “problem field”,  they should be recreated manually.

Click below to expand comments form..