I have created two list. One is "Storage" the other is "Approvers"
I am able to retrieve all values in the column 'System' in the "Storage" list by iterating through the column list, like so and placing into a global var.
using (SPSite siteCol = new SPSite("http://dev.portal.net/it/dev"))
{
using (SPWeb web = siteCol.OpenWeb())
{
//Get Storage list
SPList list = web.Lists["Storage"];
//Iterate through the items in the list
foreach (SPListItem item in list.Items)
{
//pick out your information needed
GlobalWorkflowVar.var = item["System"].ToString();
}
Next, I get the "Approvers" list and query that list to retrieve the results.
using (SPSite siteCol2 = new SPSite("http://dev.portal.net/it/dev"))
{
using (SPWeb web2 = siteCol2.OpenWeb())
{
SPList groupList = web2.Lists["Approvers"];
//Write SPQuery/CAML query
SPQuery myquery = new SPQuery();
myquery.Query =
//"<Query>" +
"<Where>" +
"<Contains>" +
"<FieldRef Name='Group' />" + "<Value Type='Text'>PO</Value>" +
"</Contains>" +
"</Where>";
I need to use the global variable so when the variable and query parameters are met, I can send out an email to the appropriate SharePoint Group I defined in the "Approver" list. How would I need to place the variable in the CAML query to retrieve the correct list items. The 'System' column within the "Approver" list has similar values to the 'System' column in the "Storage" list where I am getting the global var.
I.E
"Storage" List - 'System' column - Email (value)
"Approver" List - 'System' column - Email (value)