I have a parent site which creates child pages programmatically. They use a custom template with a List which I have created in VS. Now I want to access that list in C# from the parent site. I have tried it like the code part below but when I loop through all available lists it isn't there. My question is, how can I acccess the list. After debugging it fails when it looks for the ArtistInformation list.
//Create website
artistWeb.Webs.Add(artist, artist, artist, artistWeb.Language, webTemplate, false, false);
}
catch (Exception ex)
{
Console.WriteLine(ex);
listItem.SystemUpdate(false);
}
fillArtistInformation();
}
public void fillArtistInformation()
{
using (SPSite siteCollection = new SPSite(fullURL))
{
SPWeb web = siteCollection.OpenWeb();
System.Diagnostics.Debug.Write(web.Title);
try
{
SPList list = web.Lists["ArtistInformation"];
SPListItem item = list.Items.Add();
item["Title"] = artist;
item["WorkAddress"] = address;
item["WorkZip"] = zip;
item["WorkCity"] = city;
item["WorkCountry"] = country;
item["Price"] = price;
item.Update();
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e);
}
}
}
}