Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
SPList _listrequest = _web.Lists.TryGetList("Employee Details");
                           SPList _listtask = _web.Lists.TryGetList("Department");
                           if (_listrequest != null && _listtask != null)
                           {
                               SPField emp = _listrequest.Fields["EmployeeName"];
                               SPField dept = _listtask.Fields["EmployeeName"];

                               _query = new SPQuery();
                               _query.Joins = "<Join Type='INNER' ListAlias='Department'>" +
                                               "<Eq>" +
                                                   "<FieldRef Name='" + emp.InternalName + "' RefType='Id'/>" +
                                                   "<FieldRef List='Department' Name='ID'/>" +
                                               "</Eq>" +
                                               "</Join>";
                               _query.ProjectedFields = "<Field Name='EmployeeNametest' Type='Lookup' List='Department' ShowField='" + dept.InternalName + "'/>";
                               _query.ViewFields = "<FieldRef Name='EmployeeName' />" +
                                   "<FieldRef Name='Department' />";//  +

}


I m getting error as( Value does not fall within the expected range )
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900