Add URLs to Hyperlinks-List via XML or C#

ListInstance Elements.xml

         <Field Name=”URL”>, Google</Field>


  • Webrelative URLs are not working here, only full or serverrelativ URLs are possible!
  • Don’t forget the space after the comma
  • C# – via Feature EventReceiver

    using (SPWeb web = properties.Feature.Parent as SPWeb)
    SPList list = web.Lists["Links"];
    SPListItem newItem = list.Items.Add();
    string name = “Google”;
    string url = “”
    newItem["URL"] = url + “, ” + name;


  • All types of URLs are possible, for example you can set up the URL using web.ServerRelativeUrl.
  • Leave a Reply

    Your email address will not be published. Required fields are marked *