Tuesday, December 16, 2014

Your account is configured to prevent you from using this computer. Please try another computer

I have got this message when I tried to access a remote machine which is in domain. I’m having all the privileges to this machine but still error got prompted.

This is actually not because of the permission but because of the active directory policy. You need to go to active directory and change the Log on To ..  

In here best thing is select All Computers option.If not add machine name to The following computers section (not the IP Address).

image

Friday, December 12, 2014

not enough physical memory is available to power on this virtual machine

This error occurred to me on VMware when I installed the latest windows 8.1 update on my machine.

 

I have found few solutions for that.

  • First try the VMWare with run as administrator.(In my case this worked)
  • Uninstall the recent update.

Thursday, November 20, 2014

We apologize for any inconvenience, but we've made the site read only while we're making some improvements

image

This message shows when I accidentally close my backup script of the SharePoint site. This massage is prompted by the SharePoint when  a site is in a maintenance mode.

Resolutions

Method 1

image

  1. Go to the central administrator
  2. Application management –> Site Collection Quotas and Locks
  3. Select the site collection and change the locks information to Not Locked.

Some times this page looks like disabled thus you need to try the method two.

Method 2

$Admin = new-object Microsoft.SharePoint.Administration.SPSiteAdministration('https://www.site/sites/sitecollection')
$Admin.ClearMaintenanceMode()

This PowerShell Script changes the site collection back to normal.

Tuesday, November 11, 2014

How to initialize the SharePoint Client Context in SharePoint Apps (Provider Hosted / SharePoint Hosted) using JSOM (JavaScript Object Model)

 

SharePoint Provider Hosted Apps

First of all we need to understand the SharePoint Provider Hosted hosting blocks.

image

Provider hosted involves two hosting domains (ex host, sphost). thus request sending to host to sphost considering as cross domain request.

For cross domain request we need to provide SPAppWebUrl to initialize the context. SPAppWebUrl  is available in Url.

Ex:-

https://host.azurewebsites.net/pages/default.aspx?SPHostUrl=https:%2F%2Fsphost.sharepoint.com%2Fsites%2app&SPLanguage=en-US&SPClientTag=0&SPProductNumber=16.0.3417.1223&SPAppWebUrl=https:%2F%2Fsphost-265535272e9c8d.sharepoint.com%2Fsites%2Fapp%2FSample&Source=https://app.azurewebsites.net/pages/default

we can get AppWebUrl by accessing Url parameter. following shows a utility function for getting Url parameter.

function getQueryStringParameter (paramToRetrieve) = {
    var params = document.URL.split("?")[1].split("&");
    for (var i = 0; i < params.length; i = i + 1) {
        var singleParam = params[i].split("=");
        if (singleParam[0] == paramToRetrieve)
            return singleParam[1];
    }
    return "";
};

This will initiate the client context using remote web Url.



var spAppWebUrl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));
var ctx = new SP.ClientContext(spAppWebUrl);
var factory = new SP.ProxyWebRequestExecutorFactory(spAppWebUrl);
ctx.set_webRequestExecutorFactory(factory);
var web = ctx.get_web();
 
ctx.executeQueryAsync(
    function () {
           alert("sucess"); },
    function (a, b) {
           alert("error");  }
);

 


SharePoint Hosted Apps


SharePoint Hosted app does not have separate hosting server. SharePoint hosted apps run on the same SharePoint server. thus client context initialization does not need to provide the Url.



var ctx = new SP.ClientContext.get_current();
var web = _sa.ctx.get_web();
ctx.executeQueryAsync(
    function () {
           alert("sucess"); },
    function (a, b) {
           alert("error");  }
);

Tuesday, October 28, 2014

Working with SharePoint folder properties using CSOM (Client Side Object model ) in SharePoint 2013

 

Accessing folder properties are but different from  SharePoint list item access. Following code demonstrates  the basics.

Create SharePoint Folder with Properties

using (var clientContext = ypurMethodToGetSpContectt() )
{
 
    var lst = clientContext.Web.Lists.GetByTitle("ListName");
    var folder = lst.RootFolder.Folders.Add("FolderName");
    
    folder.Properties["property1"] = "sample";
    folder.Properties["property1"] = "sample";
 
    folder.Update();
    clientContext.ExecuteQuery();
 
}

Friday, October 10, 2014

SharePoint 2013 Licensing model

SharePoint 2013 licensing model has changed bit for user scenarios. it has been slightly change from the SharePoint 2010 server user licensing model.

SharePoint Server should be license under two categories.

  • Server License
  • Client Access License (CAL)

Server License

Each SharePoint server in the farm should be license under SharePoint server license. Apart from the windows server licenses, SharePoint server should be licensed. This can be done when the time of installation of the SharePoint server.

The SQL servers in the SharePoint farm should be installed according to the SQL server licensing model.

Client Access License (CAL)

After that SharePoint farm should hold licenses for client access. These licenses are reviewed in the audit process and does not require any key in activation.

Depending on the user accessing organization requires to have CALs.

Intranet and Extranet CAL requirements

Assume organization setup a intranet and which is having users from internal AD , authentication providers. If all the user sources are with in the intranet and users are part of the organization; then each user needs a CAL to access the SharePoint server. CAL requirement is still valid for users who access the SharePoint server via internet.

Assume via authentication providers (Ex:- Membership Provider) , SharePoint is extended for Selected External Users (Named External Users) and Users are external and not part of the organization; thus no CAL is required for the user Access.

Internet CAL requirement

Assume SharePoint installation is as a public facing site and anonymous users are accessing the to view the content. thus these users does not require any CAL for accessing the content.

Reference : Microsoft

Tuesday, September 30, 2014

How to add/update SharePoint user field (person group column) using ECMA Scripts

 

SharePoint app model supports enough capability to work with SharePoint from JavaScript.

Working with Person Group column is a common task in SharePoint development. Following illustrates how to  update  a single and multiple values to  SharePoint person group column.

Insert / Update Single Value SharePoint Person Group Column (People Field)

Tip: For single value you should refer the person or group by ID

var  user = new SP.FieldUserValue();
user = 1; // this is the ID for User or Group in SharePoint
 
listitem.set_item("Column Name", user);
listitem.Update();
ctx.ExecuteQuery();

Insert / Update Multi Value SharePoint Person Group Column (People Field)


Tip: For multiple users you need to refer it by login name



var  users =[];
 
users.push(SP.FieldUserValue.fromUser("dev Members")); // adding group
users.push(SP.FieldUserValue.fromUser("i:0#.f|membership|melick@oapp.onmicrosoft.com")); // adding user
 
 
listitem.set_item("Column Name", users);
listitem.Update();
ctx.ExecuteQuery();


*listitem  this is the list item you need to manipulate. If you are inserting a item this will be created using ListItemCreationInfo and if you are updating a item this will be a reference to the item you seek


Ref: http://msdn.microsoft.com/en-us/library/office/hh185011(v=office.14).aspx

Tuesday, September 9, 2014

Programmatically Change Default Content Type in SharePoint 2013 List

 

SharePoint list does not have any direct property or method to make content type default. but it is having content type ordering. thus making content type in first of the list automatically makes that content type default.

following shows a sample code

using (var site = new SPSite("url"))
{
   using (var web = site.AllWebs["yourweb"])
   {
       var lst = web.Lists["Your List"];
   
       SPContentTypeCollection currentOrder = lst.ContentTypes;
 
       // make default content type
       var newOrder = currentOrder.Cast<SPContentType>().Where(ct => ct.Name.Contains("Content Type To Default")).ToList();
       lst.RootFolder.UniqueContentTypeOrder = newOrder;
       lst.RootFolder.Update();            
   }
}
 
 

Friday, September 5, 2014

The Managed Metadata Service or Connection is currently not available. The Application Pool or Managed Metadata Web Service may not have been started. Please Contact your Administrator.

 

ManagedMetadataServiceError

I noticed this error when I logged to SharePoint farm; Meta Data service application.

Tasks going to perform

  • Get the Current Mapped Data Base for Managed Meta Data Service
  • Backup Data Base and get the name
  • Delete Meta Data Service Application with out Data Base
  • Create a New Managed Meta Data Service with new Application Pool
  • Change the Data base reference to old database

When I googed I found few resolutions which didn’t work for me. so I tried a slightly different approach which worked for me.

Get the Current Mapped Data Base for Managed Meta Data Service

Go to central admin and navigate to Manage Meta Data Service properties to find out mapped data base.

image

image

Then go to your database server and backup the database for recovery purposes. (this step is not mandatory but good for safe side)

Delete Meta Data Service Application with out Data Base

image

image

Create a New Managed Meta Data Service with new Application Pool

image

When you creating specify a new data base name (DB1) and new application pool.

 Change the Data base reference to old database

after that go to Managed Meta Data Properties (like first step) and change the Data Base name to original one.

in my case DB1 –> MetaData 

Tuesday, August 26, 2014

An error occurred while talking to SMTP host mail.something.local Event ID 6858

this error occurred to me when I setup SMTP virtual sever for SharePoint farm. then I tried to trouble shoot email sending using PowerShell and it also return False.

Trouble shooting SharePoint Emails (SMTP server) 

$dict = new-object System.collections.specialized.stringdictionary
// recipient's Email Address
$dict .add("to","somebosy@gmail.com")
// sender: you can put anything that you want to visible in the email
$dict .add("from","outsender@sharepoint.local")
$dict .add("Subject","sample subject")
// this is any existing sp web url
$web = get-spweb "http://4587wfe2013:5003"
$body = "This is our body codes in it."
[Microsoft.SharePoint.Utilities.SPUtility]::SendEmail($web,$sd,$body)

This code will return True if success otherwise will be False.


This error occurred me because of connection issues to SMTP server. thus I go to SMTP properties


 image


Then go to Access Tab and click Connection and Relay buttons and make the radio selection to all except to list below.


image


image

Tuesday, July 29, 2014

SharePoint 2013 Training–Part 1

Share Point Training 2014

Hosted a SharePoint training for Pyxle colleagues; session went well with practical sessions and technical discussions.

Tuesday, July 15, 2014

SharePoint Sample Field (Columns) Schemas

SharePoint Fields (Columns) XML is essential for every SharePoint Object Model development.

Multiple User Field

<Field
     ID="{f6377553-35fc-4166-9cc3-88fa32a5d7dd}"
     Name="WFCApprovers"
     DisplayName="WFC Approvers"
     Type="UserMulti"
     Required="FALSE"
     UserSelectionMode="0"
     Group="Custom">
</Field>

UserSelectionMode Options: 0 - PeopleOnly , 1 - PeopleAndGroup



Single User Field





<Field
     ID="{f6377553-35fc-4166-9cc3-88fa32a5d7dd}"
     Name="UserField"
     DisplayName="User Field"
     Type="User"
     Required="FALSE"
     UserSelectionMode="1"
     Group="Custom">
</Field>


Boolean Field





<Field
     ID="{6ed8dbbf-4726-4a63-b358-e4797149a8ba}"
     Name="Booleanfld"
     DisplayName="Boolean Feild"
     Type="Boolean"
     Required="FALSE"
     Group="Custom">
  <Default>1</Default>
</Field>


Text Field





<Field
     ID="{9253731d-2eba-48a1-8172-94e3eae4d266}"
     Name="TextField"
     DisplayName="Text Field"
     Type="Text"
     Required="FALSE"
     Group="Custom">
</Field>


Note Field





<Field
     ID="{9253731d-2eba-48a1-8172-94e3eae4d266}"
     Name="TextField"
     DisplayName="Text Field"
     Type="Note"
     Required="FALSE"
     Group="Custom">
</Field>


Number Field





<Field
     ID="{d0b93b5a-7df2-4aa8-95ce-98c89feefb8b}"
     Name="NumberField"
     DisplayName="NumberField"
     Type="Number"
     Required="FALSE"
     Group="Custom">
</Field>


Choice Field





<Field
     ID="{1af7f723-5eb6-43fc-a399-f6dde4397598}"
     Name="ChoiceField"
     DisplayName="Choice Field"
     Type="Choice"
     Required="FALSE"
     Group="Custom">
  <CHOICES>
    <CHOICE>NEW</CHOICE>
    <CHOICE>OLD</CHOICE>
  </CHOICES>
</Field>


Lookup List





<Field 
       ID="{d98ee21b-158e-49ff-b45e-86fb6df54225}"
       Name ="LookupList"
       DisplayName="Lookup List" 
       Type="Lookup" 
       List="Lists/List1"  
       ShowField="Title"
       Group="Custom" >
</Field>


Multi Lookup List





<Field 
       ID="{d98ee21b-158e-49ff-b45e-86fb6df54225}"
       Name ="LookupList"
       DisplayName="Lookup List" 
       Type="LookupMulti" 
       Mult="True" 
       List="Lists/List1"  
       ShowField="Title"
       Group="Custom" >
</Field>


Date Field





<Field
     ID="{33a66323-6665-434e-98b1-be3d3f692ac3}"
     Name="DateField"
     DisplayName="Date Field"
     Type="DateTime"
     Required="FALSE"
     Group="Custom">
</Field>


Calculated Field





<Field
     ID="{64027cf3-2e86-44df-8ae4-7c3fe56128e3}"
     Name="ConcatTitle"
     DisplayName="Concat Title"
     Type="Calculated"
     ResultType="Text"
     Required="FALSE"
     Group="Custom">
  <Formula>
    =CONCATENATE(PCode,&quot;-&quot;,Title)
  </Formula>
  <FormulaDisplayNames>
    =CONCATENATE([P Code],&quot;-&quot;,Title)
  </FormulaDisplayNames>
  <FieldRefs>
    <FieldRef Name="PCode" />
    <FieldRef Name="Title" />
  </FieldRefs>
</Field>