none
Custom Field Types Developed in SharePoint 2010 Error in SharePoint 2013 RRS feed

  • Question

  • I developed some custom field types in SharePoint 2010 a few years ago that have been working fine. We are upgrading to SharePoint 2013. I opened the Custom Field Types project in Visual Studio 2013 and built it and published it. I can see the custom fields appear for use when I go into List Settings and select create column.  The 2010 project method I used was similar to this: https://weblogs.asp.net/sreejukg/developing-custom-field-type-for-sharepoint-2010

    The custom fields in 2010 return data like the full name, location, etc of the logged on user.  In 2013, the data is not displaying in the custom fields (neither in existing lists, nor in a new list I created and chose the custom field type).  The error with correlation ID I'm getting when I try to save the item is "Failed to get value of the "<column name>" column from the "<Custom Field Type Control Name>" field type control.  See details in log. Exception Message: Object reference not set to an instance of an object"

    One item in the log is "Control template "currUserNameFieldControl" does not exist" which I'm assuming is the main line that refers to my error (I can post the entire verbose log section).

    When I look in C:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES I see this control template .ascx file.  When I look in \15\TEMPLATE\CONTROLTEMPLATES I don't see it. 

    I'm not really sure where to look for the issue.  The custom fields appear when you go to list settings and want to create a column, so at least part got deployed. But I'm thinking the .ascx files should be in the 15 hive, not the 14? - I'm not sure why they're not going there when I publish.  There doesn't seem to be a way in VS to force which hive when I add the mapped folder (Deployment Location for CONTROLTEMPLATES is SharePointRoot\Template\CONTROLTEMPLATES which I'm assuming is pointing to 14 hive, but how do you change that?  If that is the problem?). And maybe this is totally not what the problem is, I'm not sure.  I tried just copying the ascx files to 15 but that didn't work.

    Any help/guidance of where to begin to look would be great. This all works fine in 2010, and the custom fields are used in alot of our lists, so I really need them to work without redoing them for SP 2013.  

    Thanks for any help!

    Thursday, February 16, 2017 6:58 PM

Answers

  • Thanks for your help in pointing me in the right direction where to look!  I checked the Product Version of the upgraded project and it was 14 even though I'd upgraded it and got the upgrade log that didn't show errors (I had to look in the manifest - I don't see what the screenshot you've got posted when I click on package properties). 

    I ended up creating a whole new project in VS 2013, copied the code over from the old project and set up all the mapped files freshly in the new project.  The new project works in SharePoint 2013 just fine.

     

    • Marked as answer by KimFromPA Friday, February 24, 2017 2:32 PM
    Friday, February 24, 2017 2:32 PM

All replies

  • Hi,

    You need update the path to SharePoint 2013 when you upgrade your project( for example: /_controltemplates/ to /_controltemplates/15/), here is one thread for your reference.

    https://zimmergren.net/upgrading-your-sharepoint-2010-visual-studio-projects-and-solutions-to-sharepoint-2013/

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Friday, February 17, 2017 1:31 AM
  • Hi, I downloaded the developer tools.  I've tried to find in the project where the paths are set, but I don't see where that is.  If I search on _controltemplates in the solution, it's not there.  What I do is right click on the project, click "Add" - "SharePoint Mapped Folder" and the top node is {SharePointRoot} then I select TEMPLATE then XML (and CONTROLTEMPLATES) to add the mapping I need for the custom fields.  It seems like {SharePointRoot} is mapped to the 14 hive, but there is nowhere in the project that I can see a way of changing that?  This is what I see when I Add SharePoint Mapped Folder.

    Tuesday, February 21, 2017 3:30 PM
  • Hi,

    Confirm the project settings are correct.

    Try to add a user control to CONTROLTEMPLATES and check where(14/15) it deployed to.

    What’s the IDE version you’re using?

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, February 23, 2017 9:00 AM
  • Thanks for your help in pointing me in the right direction where to look!  I checked the Product Version of the upgraded project and it was 14 even though I'd upgraded it and got the upgrade log that didn't show errors (I had to look in the manifest - I don't see what the screenshot you've got posted when I click on package properties). 

    I ended up creating a whole new project in VS 2013, copied the code over from the old project and set up all the mapped files freshly in the new project.  The new project works in SharePoint 2013 just fine.

     

    • Marked as answer by KimFromPA Friday, February 24, 2017 2:32 PM
    Friday, February 24, 2017 2:32 PM