I am using visual studio 2010 and trying to build a small console program to add data to users in Sharepoint 2010 using UserProfileManager.
**using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.Office.Server.UserProfiles;
using System.DirectoryServices.AccountManagement;
using System.IO;**
The problem I am getting is trying to build this. If my target framework is 4.0 it builds fine, but hence does not run on the server where sharepoint is deployed:
*Unhandled Exception: System.PlatformNotSupportedException: Microsoft SharePoint is not supported with version 4.0.30319.269 of the Microsoft .Net Runtime. at Microsoft.SharePoint.Administration.SPConfigurationDatabase.get_Farm() at Microsoft.SharePoint.Administration.SPFarm.FindLocal(SPFarm& farm, Boolean & isJoined) at Microsoft.SharePoint.SPSite..ctor(String requestUrl) at AddRandomMindtags.Program.Main(String[] args)*
When the target framework is set to 3.5 it gets the following build error:
*The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
The type or namespace UserProfileManager could not be found...*
Anyone any idea what the problem might be?
Many thanks :)