Note that there are some explanatory texts on larger screens.

plurals
  1. POSharePoint add item to custom list results in "Invalid URL value. A URL field contains invalid data. Please check the value and try again"
    primarykey
    data
    text
    <h2>Setup</h2> <p>I am programmatically adding elements to a custom list with custom columns from C# code:</p> <pre><code>// Get the list var context = SPContext.Current; var web = context.Site.RootWeb; web.AllowUnsafeUpdates = true; var favoritesList = web.Lists["Favoritter"]; // Check if new item already exists var query = new SPQuery { Query = string.Format( "&lt;Where&gt;" + "&lt;And&gt;" + "&lt;Eq&gt;&lt;FieldRef Name='Brugernavn'/&gt;&lt;Value Type='Text'&gt;{0}&lt;/Value&gt;&lt;/Eq&gt;" + "&lt;And&gt;" + "&lt;Eq&gt;&lt;FieldRef Name='Fagomr_x00e5_de'/&gt;&lt;Value Type='Text'&gt;{1}&lt;/Value&gt;&lt;/Eq&gt;" + "&lt;Eq&gt;&lt;FieldRef Name='N_x00f8_gletalsnummer'/&gt;&lt;Value Type='Text'&gt;{2}&lt;/Value&gt;&lt;/Eq&gt;" + "&lt;/And&gt;" + "&lt;/And&gt;" + "&lt;/Where&gt;", GetUserName(false), omraade, noegletalsId) }; var items = favoritesList.GetItems(query); if (items.Count &gt; 0) return false; // Otherwise add the new item var favorite = favoritesList.Items.Add(); favorite["Brugernavn"] = GetUserName(false); favorite["Fagomr_x00e5_de"] = omraade; favorite["N_x00f8_gletalsnummer"] = noegletalsId; favorite.Update(); // &lt;--- THIS LINE THROWS EXCEPTION web.AllowUnsafeUpdates = false; return true; </code></pre> <h2>The problem</h2> <p>When I perform the <code>Update()</code> command on the new item the following exception is thrown:</p> <pre><code>Microsoft.SharePoint.SPException: Invalid URL value. A URL field contains invalid data. Please check the value and try again </code></pre> <h2>Additional information</h2> <p>The three custom columns I have made are all of type <code>SPFieldText</code> and thus have <em>nothing</em> to do with URLs.</p> <p>I have also hidden the default Title field using PowerShell:</p> <pre><code>$titleField = $favoritesList.Fields.GetField("Title") $titleField.LinkToItem = $false $titleField.Required = $false $titleField.Hidden = $true $titleField.Update() </code></pre> <p>The XML schema for list can be found <a href="https://www.dropbox.com/s/dg439upzym6cu09/Schema.xml" rel="nofollow">here</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload