Search code examples
linqsharepointms-wordword-2007

Word template gives "method not supported exceptions" for many method calls


Context: I'm trying to develop a Word 2007 template in Visual Studio 2010. Target framework is .NET 3.5. I'm using SharePoint 2010's WCF and I've added a "Service Reference" to my Word 2007 Template project. I'm debugging in VS.

I was calling the Max() method using LINQ and I get an exception. I don't understand why, since Visual Studio shows the method in my intellisense. But when I go to my "object browser" and I go to the DataServiceQuery class, the only methods I see are AddQueryOption, BeginExecute, Execute, EndExecute, GetEnumerator, and 2-3 others. I don't see any of the LINQ methods like Max(), Min(), Single(), etc, and if I call those none of them work with the NotSupportedException.

Is the Intellisense messed up? Am I doing something else wrong? Any tips on how to start debugging this issue?


Solution

  • From: http://msdn.microsoft.com/en-us/library/dd673933.aspx.

    The set of queries expressible in the LINQ syntax is broader than those enabled in the representational state transfer (REST)-based URI syntax that is used by data services. A NotSupportedException is raised when the query cannot be mapped to a URI in the target data service.