I have a code where I want to debug that why it cannot open the subsite, however in quickwatch window it opens it fine by doing "site.openweb(str[1])"
My code below (where str[0] has the server name and str[1] has subsite name):
SPWeb spwebdest = null;
SPSite site = null;
try
{
SPListItem spitem = workflowProperties.Item;
string[] str = workflowProperties.AssociationData.Split(',');
string Listtitle = spitem.ParentList.Title;
if (!string.IsNullOrEmpty(str[1]))
{
spwebdest = new SPSite("http://" + str[0]).OpenWeb(str[1]);
}
else
{
site = new SPSite("http://" + str[0]);
spwebdest = site.RootWeb;
}
SPList list = spwebdest.Lists[str[2]];
SPListItemCollection itemcoll = list.GetItems(new SPQuery()
{
Query = @"<Where>
<Eq>
<FieldRef Name='Title' />
<Value Type='Text'>" + spitem.Title + "</Value></Eq></Where>"
});
Need help
Thanks.