Hello,
I´m trying next example
http://msdn.microsoft.com/en-gb/library/ff630942.aspx
but I have the error:
‘Microsoft.SharePoint.SPContentTypeCollection’ no contiene una definición de ‘Cast’ ni se encontró ningún método de extensión ‘Cast’ que acepte un primer argumento de tipo ‘Microsoft.SharePoint.SPContentTypeCollection’ (¿falta una directiva de uso o una referencia de ensamblado?
With Google Translate ;
‘Microsoft.SharePoint.SPContentTypeCollection’ does not contain a definition for ‘Cast’ and found no extension method ‘Cast’ accepting a first argument of type ‘Microsoft.SharePoint.SPContentTypeCollection’ (are you missing a using directive or reference assembled?
The problem is in the line:
SPField newField = spWeb.Fields .Cast<SPField>() .FirstOrDefault(f => f.StaticName == “Team Project”);
Some idea?
Regards,
María
Can you post your code ? (screenshot will do to preserve formatting). ta
Thank you Mark and Suresh… using the System.Linq library, I dont get errors.
But now, when I deploy the project, I get this error:
Error 1 Error en el paso de implementación ‘Reciclar grupo de aplicaciones de IIS’: El servidor de SharePoint local no está disponible. Compruebe que el servidor se está ejecutando y está conectado a la granja de servidores de SharePoint.
Translate with Google:
Error 1 Error in deployment step ‘Recycle IIS Application Pool’: The local SharePoint server is not available. Verify that the server is running and connected to the SharePoint farm.
Regards,
María
Hi Maria
I think the problem is because “.Cast” is an extension that’s added by Linq (http://msdn.microsoft.com/en-us/library/bb341406(v=vs.90).aspx). Try adding “using System.Linq” at the top.
That should fix it.