I am following this tutorial
var groups = from sharePo开发者_如何学运维intGroup in groupsXml.Root.Elements("Group")
select new
{
Name = sharePointGroup.Attribute("Name").Value,
Owner = sharePointGroup.Attributes("Owner").Any() ? sharePointGroup.Attribute("Owner").Value : null,
Description = sharePointGroup.Attributes("Description").Any() ? sharePointGroup.Attribute("Description").Value : string.Empty,
PermissionLevel = sharePointGroup.Attributes("PermissionLevel").Any() ? sharePointGroup.Attribute("PermissionLevel").Value : null,
Users = sharePointGroup.Elements("User").Any() ? sharePointGroup.Elements("User") : null
};
They have this: groupsXml.Root.Elements("Group")
but when I try to do this I get an error
Error 3 Could not find an implementation of the query pattern for source type 'System.Collections.Generic.IEnumerable'. 'Select' not found. Are you missing a reference to 'System.Core.dll' or a using directive for 'System.Linq'
When I look at my references I can't see System.Linq(only System.Xml.Linq; and SharePoint.linq)
When I look up on msdn I see that it takes in a "Xname" instead of a string
- Xname has a constructor that takes a string, so this is correct.
- If you have no
using System.Linq;
, you need to add it. - You don't need to add any reference to your project. The namespace
System.Linq
is defined in the System.Core.dll assembly, which is referenced by default.
精彩评论