private void LoadAssignments() { try { // Get the user name and their assignments self = EnterpriseResource.GetSelf(projContext); projContext.Load(self, r => r.Name, r => r.Assignments.IncludeWithDefaultProperties(assignment => assignment.Project)); projContext.ExecuteQuery(); lblUserName.Text = String.Format("Welcome {0}", self.Name); // Get the assignments and Project Name for the resource string name; Guid id; // Add each assignment to the list checkbox for (int j = 0; j < self.Assignments.Count; j++) { name = self.Assignments.ElementAt(j).Project.Name + ": " + self.Assignments.ElementAt(j).Name; id = self.Assignments.ElementAt(j).Id; Assignment assignment; if (self.Assignments.ElementAt(j).PercentComplete < 100) { assignment = new Assignment(name, id, false); chkAssignments.Items.Add(assignment); } else { assignment = new Assignment(name, id, true); chkAssignments.Items.Add(assignment, true); } assignment.Dirty = false; } } catch (ClientRequestException cre) { string msg = string.Format("Error: \n\n{1}", cre.GetBaseException().ToString()); throw new ArgumentException(msg); } catch (Exception ex) { string msg = string.Format("Error: \n\n{1}", ex.ToString()); throw new ArgumentException(msg); } }