I am creating a form template using VSTO in visual studio 2005. Everything is FULL TRUST and the form template is being loaded in a forms document library in Sharepoint 3.0.
I only want to use the form in browser only mode.
I am quite new at this so please be patient. I am creating a simple support ticket system
I am having a nightmare trying to query a custom sharepoint list. The query is returning data but the data is not filtered. here is the code i am using
StringBuilder camlBuilder = new StringBuilder();
string xpath;
xpath = "/my:myFields/my:ClientName";
XPathNavigator ClientName = this.MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);
xpath = "/my:myFields/my:test";
XPathNavigator test = this.MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);
camlBuilder.Append("<Query>");
camlBuilder.Append("<Where>");
camlBuilder.Append("<Eq>");
camlBuilder.Append("<FieldRef Name=\"Company\" />");
camlBuilder.Append("<Value Type=\"Text\">");
camlBuilder.Append(ClientName.Value.ToString());
camlBuilder.Append("</Value>");
camlBuilder.Append("</Eq>");
camlBuilder.Append("</Where>");
camlBuilder.Append("</Query>");
string queryText = camlBuilder.ToString();
SPWeb site = SPContext.Current.Web;
SPList list = site.Lists["Client Contact List"]; //name of list
SPQuery query = new SPQuery(list.DefaultView);
query.Query = queryText;
xpath = "/my:myFields/my:debug";
XPathNavigator debug = this.MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);
debug.SetValue("Query = " + query.Query);
SPListItemCollection results = list.GetItems(query);
xpath = "/my:myFields/my:ClientContact";
XPathNavigator ClientContact = this.MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);
xpath = "/my:myFields/my:Issue";
XPathNavigator Issue = this.MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);
Issue.SetValue(ClientContact.OuterXml.ToString());
foreach (SPListItem l in results)
{
try
{
ClientContact.SetValue(l["Full_x0020_Name"].ToString());
test.SetValue(test.Value.ToString() + " " + l["Full_x0020_Name"].ToString());
}
catch (Exception exp)
{
xpath = "/my:myFields/my:debug";
debug.SetValue(exp.Message);
}
}
Other issue.
I then want to take this returned query and load a drop down list with the information. I cannot find ANY code on the internet anyway that explains how to do this. I am trying to output the XPathNavigator to get the XML but it doesn't seem to work. Please any help is desperately required.
Regards
Paul