Monday, 18 July 2016

Load All UserProfile properties CSOM


Load All the UserProfile properties of a Logged in User 



Below code will load all user profile properties of a current logged in user in CSOM


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.UserProfiles;
using System.Net;


namespace UserProfilePropertiesCSOM
{
    class Program
    {
        static void Main(string[] args)
        {

            ClientContext ctx = new ClientContext("http://Sharepointdevsite:3636/");
            var cuser = ctx.Web.CurrentUser;
            ctx.Load(cuser); //Load the Current Logged User
            ctx.ExecuteQuery();       
            PeopleManager peopleManager = new PeopleManager(ctx);        
            PersonProperties userProperites = peopleManager.GetPropertiesFor(cuser.LoginName);
            ctx.Load(userProperites, p => p.AccountName, p =>
            p.UserProfileProperties);
            ctx.ExecuteQuery();
            foreach (var property in userProperites.UserProfileProperties)
            {
                Console.WriteLine(string.Format("{0}: {1}",
                property.Key.ToString(), property.Value.ToString()));
            }
            Console.ReadKey(false);

        }
    }
}

Ouput:





Monday, 4 July 2016

Unknown SharePoint version: 16.0 Parameter name: version 0 0

Error while deploying app to SharePoint 2013 from Visual Studio



Solution :


Go to Project -> Project Properties from Visual Studio

 i.e In the Tools menu

Debub -> yourprojectName Properties  ( In mycase its TestApp Properties)














In SharePoint Tab -> Change the Version from SharePoint online to SharePoint 2013 and Click OK

Try to Rebuild and deploy the solution hope it should fix




Tuesday, 7 June 2016

Message from External System Login Failed for user ....


Message from External System Login Failed for user ....


When we are trying to create an External Content type with SharePoint Designer we will face an issue some thing like Message from External System Login Failed for user ... In order to fix it follow the below steps,.




Solution :

Click on Add Connection - > Select  second option Connect with impersonated Windows Identity

and provide Secure Store Application Id which was created in Central Admin to connect external system and Click on Ok button


select the option as per your requirment by Right clicking on Students table




Access denied by Business Data Connectivity.


Access denied by business data connectivity when creating external content type



Solution :


Go to Central Administration -> Manage Service Applications -> Business Connectivity Service application



Select the External Content type which you have created, and click on Set Object Permissions button in the ribbon,

In my case its NewExternal content type.



Type EveryOne and click on Add button and Select Execute Check box and Click on OK Button




That's set..., you will be able to see the result , if still getting same error select Edit checkbox and try it.






Tuesday, 31 May 2016

The Secure Store Service application Secure Store Service Application is not accessible. The full exception text is:

Secure Store Service is not accessible

The Secure Store Service application Secure Store Service Application is not accessible. The full exception text is: The HTTP service located at https://........./SecureStoreService.svc/https is unavailable.  This could be because the service is too busy or because no endpoint was found listening at the specified address. Please ensure that the address is correct and try accessing the service again later.













Resolution:

1. Check AppPool Account which secure store service is running is not stopped.

Go to Inetmgr -> Find the application pool for Secure store Service  





If Stopped - start the AppPool



2.  Check if Secure store service is not started,  if not go and Start as below.

Central Admin - > Application Management -> Manage Services on the Server 

Secure Store Service -> Start


Hope this will fix the issue , 

A Network-related or instance-specific error occurred while establishing connection to SQL Server,

A Network-related or instance-specific error occurred while establishing connection to SQL Server, The Server was not found or was not accessible. verify that instance name is correct and that SQL Server is configured to allow remote connections.





Solution :




Monday, 30 May 2016

Verification of prerequisites for Domain Controller promotion failed. The local Administrator account becomes the domain Administrator account when you create a new domain. The new domain cannot be created because the local Administrator account password does not meet requirements. Currently, a password is not required for the local Administrator account. We recommend that you use the net user command-line tool with the /passwordreq:yes option to require a password for this account before you create the new domain; otherwise, a password will not be required for the domain Administrator account.

Error While Setting Active Directory:


Verification of prerequisites for Domain Controller promotion failed. The local Administrator account becomes the domain Administrator account when you create a new domain. The new domain cannot be created because the local Administrator account password does not meet requirements. Currently, a password is not required for the local Administrator account. 

We recommend that you use the net user command-line tool with the /passwordreq:yes option to require a password for this account before you create the new domain; otherwise, a password will not be required for the domain Administrator account.


Resolution: