Skip to main content
added 51 characters in body
Source Link
Raf
  • 1k
  • 8
  • 28

You can put SPQuery request(CAML) before adding new item. In CAML request you can find all items that have similar 'classID' and 'Title'. And change 'IsEvaluated' to False for this items.

It is example, but you need to change SPQuery request

                        var query = new SPQuery
                        {
                            Query = String.Format("<Where><Eq><FieldRef Name='{0}' LookupId="TRUE" /><Value Type='Lookup'>{1}</Value></Eq></Where>",
                                        "classID", id)
                        };
                        var items = list.GetItems(query);

                        if (items.Count > 0)
                        {
                            foreach (SPListItem item in items){
                               item["IsEvaluated"]= false;
                               item.Update();
                            }
                        }

You need to add 'AND' statement in SPQuery. How to do it read here. It is not clear what is 'id' in your code. In my example it is integer(it is lookup id value).

You can put SPQuery request(CAML) before adding new item. In CAML request you can find all items that have similar 'classID' and 'Title'. And change 'IsEvaluated' to False for this items.

It is example, but you need to change SPQuery request

                        var query = new SPQuery
                        {
                            Query = String.Format("<Where><Eq><FieldRef Name='{0}' LookupId="TRUE" /><Value Type='Lookup'>{1}</Value></Eq></Where>",
                                        "classID", id)
                        };
                        var items = list.GetItems(query);

                        if (items.Count > 0)
                        {
                            foreach (SPListItem item in items){
                               item["IsEvaluated"]= false;
                            }
                        }

You need to add 'AND' statement in SPQuery. How to do it read here. It is not clear what is 'id' in your code. In my example it is integer(it is lookup id value).

You can put SPQuery request(CAML) before adding new item. In CAML request you can find all items that have similar 'classID' and 'Title'. And change 'IsEvaluated' to False for this items.

It is example, but you need to change SPQuery request

                        var query = new SPQuery
                        {
                            Query = String.Format("<Where><Eq><FieldRef Name='{0}' LookupId="TRUE" /><Value Type='Lookup'>{1}</Value></Eq></Where>",
                                        "classID", id)
                        };
                        var items = list.GetItems(query);

                        if (items.Count > 0)
                        {
                            foreach (SPListItem item in items){
                               item["IsEvaluated"]= false;
                               item.Update();
                            }
                        }

You need to add 'AND' statement in SPQuery. How to do it read here. It is not clear what is 'id' in your code. In my example it is integer(it is lookup id value).

deleted 1 character in body
Source Link
Raf
  • 1k
  • 8
  • 28

You can put SPQuery request(CAML) before adding new item. In CAML request you can find all items that have similar 'classID' and 'Title'. And change 'IsEvaluated' to False for this items.

It is example, but you need to change SPQuery request

                        var query = new SPQuery
                        {
                            Query = String.Format("<Where><Eq><FieldRef Name='{0}' LookupId="TRUE" /><Value Type='Lookup'>{1}</Value></Eq></Where>",
                                        "classID", id)
                        };
                        var items = list.GetItems(query);

                        if (items.Count > 0)
                        {
                            foreach (SPListItem item in items){
                               item["IsEvaluated"]= false;
                            }
                         }

You need to add 'AND' statement in SPQuery. How to do it read here. It is not clear what is 'id' in your code. In my example it is integer(it is lookup id value).

You can put SPQuery request(CAML) before adding new item. In CAML request you can find all items that have similar 'classID' and 'Title'. And change 'IsEvaluated' to False for this items.

It is example, but you need to change SPQuery request

                        var query = new SPQuery
                        {
                            Query = String.Format("<Where><Eq><FieldRef Name='{0}' LookupId="TRUE" /><Value Type='Lookup'>{1}</Value></Eq></Where>",
                                        "classID", id)
                        };
                        var items = list.GetItems(query);

                        if (items.Count > 0)
                        {
                            foreach (SPListItem item in items){
                               item["IsEvaluated"]= false;
                            }
                         }

You need to add 'AND' statement in SPQuery. How to do it read here. It is not clear what is 'id' in your code. In my example it is integer(it is lookup id value).

You can put SPQuery request(CAML) before adding new item. In CAML request you can find all items that have similar 'classID' and 'Title'. And change 'IsEvaluated' to False for this items.

It is example, but you need to change SPQuery request

                        var query = new SPQuery
                        {
                            Query = String.Format("<Where><Eq><FieldRef Name='{0}' LookupId="TRUE" /><Value Type='Lookup'>{1}</Value></Eq></Where>",
                                        "classID", id)
                        };
                        var items = list.GetItems(query);

                        if (items.Count > 0)
                        {
                            foreach (SPListItem item in items){
                               item["IsEvaluated"]= false;
                            }
                        }

You need to add 'AND' statement in SPQuery. How to do it read here. It is not clear what is 'id' in your code. In my example it is integer(it is lookup id value).

Source Link
Raf
  • 1k
  • 8
  • 28

You can put SPQuery request(CAML) before adding new item. In CAML request you can find all items that have similar 'classID' and 'Title'. And change 'IsEvaluated' to False for this items.

It is example, but you need to change SPQuery request

                        var query = new SPQuery
                        {
                            Query = String.Format("<Where><Eq><FieldRef Name='{0}' LookupId="TRUE" /><Value Type='Lookup'>{1}</Value></Eq></Where>",
                                        "classID", id)
                        };
                        var items = list.GetItems(query);

                        if (items.Count > 0)
                        {
                            foreach (SPListItem item in items){
                               item["IsEvaluated"]= false;
                            }
                         }

You need to add 'AND' statement in SPQuery. How to do it read here. It is not clear what is 'id' in your code. In my example it is integer(it is lookup id value).