Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating SharePoint field links

I used a piece of code that retrieves a field link for a specified content type and sets the field to either required or not required. This works fine but when I try to do the same for a field that has spaces in the name, the code throws an error.

SPField col = //some column retrieved from a list
SPContentType ct = col.ParentList.ContentTypes["MyContentTypeName"] //gets the content type

SPFieldLink fieldLink = ct.FieldLinks["MyFieldname"]; // gets the fieldLink
ct.Update(); 

It works if MyFieldName is a string like "Hobbies" or "Amount", but fails if it's a string like "Full Name".

Is there a workaround?

like image 874
jidexl21 Avatar asked Dec 04 '12 15:12

jidexl21


People also ask

How do you update a hyperlink?

Change an existing hyperlinkRight-click anywhere on the link and, on the shortcut menu, click Edit Hyperlink. In the Edit Hyperlink dialog, select the text in the Text to display box. Type the text you want to use for the link, and then click OK.

How do I set the display text for a SharePoint Hyperlink field in power apps?

Try this approach. In your form, select the hyperlink field and unlock the datacard. Now add HTML text field to the selected data card and rename it something like 'hyperlink'. Set its properties like X,Y,Height and Width etc.


1 Answers

You are probably using the field display name instead of the field internal name

Have you tried: "Full_x0020_Name" ?

like image 158
toma19 Avatar answered Oct 05 '22 02:10

toma19