3

I am replacing a colleague for the support of a SharePoint 2010 intranet.
A functionality has been implemented allowing users to make holiday requests.
The user fills in an InfoPath form to make an holiday request.
The holiday requests are stored in a document library.

I have deleted a useless field in the InfoPath form by using "InfoPath Designer".
The deleted field was associated with a column in the holiday request library.
I have republished the form.
I expected the column to be automatically deleted but the column has not been deleted.
The column is unclickable in the library settings so I can not delete it manually.

What should I do to delete the useless column ?
Any help will be greatly appreciated

2

I deleted read-only columns in Form library using client object model as,

ClientContext context = new ClientContext(sharePointSiteURL);Site oSite = context.Site;Site oSite = context.Site;context.Load(oSite);Web web = context.Web;List doclist = web.Lists.GetByTitle("LibraryName");context.Load(doclist);context.ExecuteQuery();FieldCollection fieldCollection = web.Lists.GetByTitle("LibraryName").Fields;if (column.InternalName.Equals("ColumnName")){column.ReadOnlyField = false;column.Update();column.DeleteObject();column.Update();context.ExecuteQuery();}}
1

There are 2 aspects to using an InfoPath form with a list/library:

  1. When using a Forms Library to store data as XML with optionally promoted fields (we are not considering Administrator published forms via SP-CA)
  2. When directly changing the edit form with InfoPath.

For both situations, you need to understand whether the Content type has previously been created in the list (and updated to use the InfoPath form as Edit form, or if Columns have been created, as promoted fields while publishing the InfoPath form.

In the list/library settings, when you see the columns greyed-out and you can't seem to be able to change settings about them, it simply means that fields are handled and promoted during publishing. In such situations fields can be changed only via InfoPath, and you actually must delete the column not only from the form, but also from the Data Source. You can find that via Data Connections and find MAIN.

Only then you can re-publish. If, however, fields are editable, it also means those fields have been created directly in the list, in which case you could directly remove them from the List settings page.

  • I have deleted the field from the MAIN data source in InfoPath Designer but the associated column has not been deleted from the library. And there are clickable columns in the library settings which are associated with fields of the MAIN data source. – user1139666 May 6 '13 at 7:25
  • It seems those columns have been previously created, not by promoting fields while publishing the InfoPath. If you really do not need these, simply delete those columns, via List Settings, not InfoPath - be aware that data loss is definite. After, you open the form and it shall detect change in the list. – Marius Constantinescu - MVP May 6 '13 at 18:24
  • 1
    But the column is unclickable in the library settings. So how can I delete the column ? – user1139666 May 7 '13 at 7:57
0

Only removing it from the infopath designer will not suffice the need.When you are publishing a form by upgrading a library . Under publishing wizard there are 3 buttons to Add,Remove or Modify the columns. Select the particular column which you want to remove and click on the Remove button and publish it.

  • The column is not present in the list of the publishing wizard. In addition I have noticed that the column is not linked to the form content type in the library settings. – user1139666 May 7 '13 at 12:44
  • I will try to reproduce this and will get back yo you on the same soon.But can you tell me as you said that it if it is not linked to Form and content type both ,then why do you want to delete it.I mean what problem is it causing? – Rameez May 7 '13 at 13:18
  • I want to delete the column because it has become useless – user1139666 May 7 '13 at 14:35
0

I have finally solved my issue.
The column was non-clickable in the library settings because it was a read-only colum.
I have deleted the column from the library by executing a PowerShell script.

$field.AllowDeletion = "true"
$field.Sealed = "false"
$field.Delete()
$list.Update()
$web.Dispose()

Where :

  • The variable $field contained a reference to the column I wanted to delete
  • The variable $list contained a reference to the library
  • The variable $web contained a reference to the site
  • even if Read-only, you should have been able to remove it via Library Settings, either directly, or if coming from a Content Type to navigate to the content type & remove it. No contradiction to my explanation to my sense. – Marius Constantinescu - MVP May 8 '13 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.