jrmcdona
Guest
|
Posted:
Sat Jan 15, 2005 1:13 am Post subject:
RE: SPList help |
|
|
So I was able to hard code the value for AllWebs["/sites/myteamsite"]
however, is there no method to retrieve this value dynamically?? My web part
will not know what site the user is on.
thanks for your time!
jordan
"jrmcdona" wrote:
| Quote: | Can somebody please show me how to get the value for
AllWebs["Destination_Site"]? I cannot seem to get the correct value for my
site which is http://localhost/sites/myteamsite and the name is "My Team
Site". The Destination list i am using is called "Events". Thanks a bunch!
I am using the following code:
SPSite site = SPControl.GetContextSite(Context);
SPList destList =
site.AllWebs["Destination_Site"].Lists["Destination_List"];
SPListItemCollection listItems = destList.Items;
SPListItem newItem = listItems.Add();
newItem["Field1_Name"] = "Scenario 2";
newItem["Field2_Name"] = 45;
newItem["Field3_Name"] = "A sample note for this item.";
newItem.Update(); |
|
|