Pergunta

I have an InfoPath form set as the primary content type on a Form Library which is working fine. The form is a Managed Template uploaded/activated through Central Admin, and contains a number of Promoted Fields.

Now I've added another field to the form in InfoPath (and added a control on the form for it, for visibility) and set that field to be promoted into the library (confirmed through both Tools -> Form Options -> Property Promotion, and the list when publishing) and published & uploaded the form (using Central Admin).

When I open the form in SharePoint (by creating a new item in the form library, or opening an existing item in that library) I see the control for my new field, and can store data in the field. However, the field is NOT promoted, in that I cannot see it in any of the following:

  • the Item Properties page (View/Edit)
  • the Create/Modify View page
  • the Columns list on the Form Library's settings page
  • the Columns list of the Content Type for the form, on the Form Library's settings page

I've tried everything I can think of to get this field promoted short of deleting the entire library and starting over. Has anyone else run into this problem? How can I promote a new field into an existing library?

Foi útil?

Solução

Well, I've sort of answered my own question...

What I ended up doing was eventually:

  1. Deleted the entire Form Library
  2. Created a new copy/version of the Form Library, and added the form's Content Type to it from the Site's Content Types Gallery

This fixed nothing. Don't do that.

My next step was probably excessive, but I:

  1. Deleted the entire Form Library
  2. Deleted the form's Content Type from the the Site's Content Types Gallery
  3. Removed the field from the InfoPath form entirely
  4. Published the form (minus field) and uploaded it in Central Admin
  5. Re-added the field in InfoPath and published, again promoting the field the same way I had before, and uploaded it through Central Admin
  6. Tried to add the form's Content Type to a new copy/version of the Form Library (the Content Type was not available)
  7. Deactivated and re-Activated the feature for the form in the Site Collection Settings
  8. Added the form's Content Type to the new Form Library

And THAT worked!

My theory is that Deactivating and re-Activating the Feature for the InfoPath form will force the promoted fields to be updated, and that until you've done that the Content Type will still be using the old fields (so that nothing you do at the Form Library level will mean a thing). But that would still be a very destructive operation if you're working on production data, and I'm hoping there's still an easier and "safer" way of updating the Promoted Properties/Fields/Columns of an InfoPath form published to SharePoint.

But there probably isn't.

Outras dicas

Just deactivating, and then reactivating the feature was enough for me. It also didn't appear to be destructive. It would perhaps depend on what is in your feature, in my case the InfoPath form and nothing else.

I have resolved (used workaround) this problem by PowerShell.
You need to know:
1) Field ID in Content Type
2) XPath to field in InfoPath form

Next You have to use this PowerShell script:

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
$web = Get-SPWeb "https://intranet.company.com"
$contentTypeName = "Content Type Name"
$ct = $web.ContentTypes[$contentTypeName]

# Content Type Fields
# Field
$fieldId = "1209bb86-645b-4e56-aea2-265a325a98af"
$fieldLinks = $ct.FieldLinks | Where-Object {$_.Id -eq $fieldId}
$fieldLinks.ReadOnly = $true
$fieldLinks.XPath = "/my:Fields/my:FieldGroup/my:Field"

$ct.Update($true)
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top