Monday, December 14, 2015

The content database on the server is temporarily unavailable.

The content database on the server is temporarily unavailable.



When you try to deploy an app via Visual Studio, you might get the this error

Solution

Configure Managed Metadata service application correctly.

Check your domain ip in DNS server.(get your ip from ipconfing from CMD )
Also make sure you have the below service applications configured correctly

1. App Management Service Application.

2. Microsoft SharePoint Foundation Subscription Settings Service Application.

Then i looked in to Event Viewer. I found below problem 



Then I started  the Distributed Cache .



Then i deploy the solution the problem solved. 
:)

CAML Query for SharePoint


What is CAML?

  Ø  CAML - Collaborative Application Markup Language
  Ø  XML- Extensible Markup Language based query language
  Ø  Used to perform a query operation against SharePoint Lists
How SharePoint List Items are retrieved?
SharePoint List data can be retrieved in any one of the following ways:
1. Using the SharePoint object model – used when code runs on the server         (Example: Developing a web part or an application page)
2. Using the SharePoint Lists web service – used when your code doesn’t run on the server where the SharePoint is installed (Example: Developing a windows application)
3. Using Power shell –used mostly by the ADMIN of the SharePoint when they quickly want to retrieve some information from the SharePoint site

How does CAML query looks like?
As I already mentioned, it is XML based query language and it contains tags in it. The root element of the CAML query root element is Query. But it is not necessary to use Query element in the query you form.
Within the Query element you have two elements possible:

1. Where   – to filter the data
2. OrderBy – to categorize the data

simple structure of the CAML query is as follows:
<Query>
          <Where>
                   <Eq>
                             <FieldRef Name=”FieldName” />
                             <Value Type=”DataType”>Value</Value>
                   </Eq>
          </Where>
          <OrderBy>
                             <FieldRef Name=”FieldName” />
                             <FieldRef Name=”FieldName” />
          </OrderBy>
</Query>

Operators in CAML Query
From the above structure, we came to know that it uses Where and OrderBy elements to retrieve the data from the list.

Let us know about the operators present in the CAML query and its usage:
Inside the Where element
1. Logical Operators - AND, OR
2. Comparison Operators - Listed Below in the table
AND – Which takes two conditions are satisfied
OR – Which takes when either of the conditions is satisfied


Comparison Operators
Inside the OrderBy/GroupBy element
OrderBy – Which orders or sort the data depends upon the field (FieldRef element) given.
GroupBy – Which groups the data depends upon the group by field (FieldRef element) given.
Examples
Logical & Comparison Operators
Use of AND, Gt, Leq
<Query>
<Where>
<And>
<Gt>
<FieldRef Name="Quantity" />
<Value Type="Number">0</Value>
</Gt>
<Leq>
<FieldRef Name="Price" />
<Value Type="Number">2000</Value>
</Leq>
</And>
</Where>
</Query>
Use of OR, Gt, Leq
<Query>
<Where>
<Or>
     <Gt>
<FieldRef Name="Quantity" />
<Value Type="Number">0</Value>
     </Gt>
                     <Leq>
  <FieldRef Name="Price" />
<Value Type="Number">2000</Value>
     </Leq>
               </Or>
       </Where>
</Query>
Use of BeginsWith, Leq
<Query>
<Where>
<And>
      <BeginsWith>
  <FieldRef Name="Title" />
  <Value Type="Text">M</Value>
      </BeginsWith>
      <Leq>
     <FieldRef Name="Quantity" />
<Value Type="Number">1000</Value>
      </Leq>
</And>
</Where>
<OrderBy>
<FieldRef Name="Price" Ascending="False" />
</OrderBy>
</Query>
OrderBy Operator
<Query>
<Where>
<Or>
    <Gt>
<FieldRef Name="Quantity" />
<Value Type="Number">0</Value>
   </Gt>
      <Leq>
<FieldRef Name="Price" />
<Value Type="Number">2000</Value>
   </Leq>
</Or>
</Where>
<OrderBy>
<FieldRef Name="Price" Ascending="True" />
</OrderBy>
</Query>
Is it possible to write this queries without any errors manually?
Yes. But we will know the errors only after executing the program. Hence there is a free CAML query builder which will generate the query easily.

Caml Queries to Remember

No Filter
<View><ViewFields><FieldRef Name="Title" /><FieldRef Name="Column2" /></ViewFields></View>
With Row Limit
<View><RowLimit>10</RowLimit><ViewFields><FieldRef Name="Title" /><FieldRef Name="Column2" /></ViewFields></View>
Above two can  be used with CamlQuery object as view xml.
example
CamlQuery camlquery = new CamlQuery();
               camlquery.ViewXml = "<View><RowLimit>10</RowLimit><ViewFields><FieldRef Name='Title'/><FieldRef Name='FileRef'/><FieldRef Name='BasePath'/></ViewFields></View>";
           
   List sSCConfigList = clientContext.Web.Lists.GetByTitle("SSCConfig");
               clientContext.Load(sSCConfigList);
               clientContext.ExecuteQuery();
               var listItems = sSCConfigList.GetItems(camlquery);
Single Select
Example
<Query><Where><Eq><FieldRef Name="Title" /><Value Type="Text">ABC VALUE</Value></Eq></Where></Query>
Multiple Rows
Example
<Query><Where><Contains><FieldRef Name="Title" /><Value Type="Text">Some Text</Value></Contains></Where></Query>
In case of Rich Text field, you can use <![CDATA[]]> around the value to prevent parsing errors when passing HTML into the query. Or you can replace < with &lt;, > with &gt; and “ with &quot; and so on.
Other operators are <Geq/> for greater than and <Leq/> for less than
LookUps
Here we use LookupId=”true”.  By using this we can specify the id value in the value tag
Look up on Id
example
<Query><Where><Eq><FieldRef Name="SomeLookupcolumn" LookupId="TRUE" /><Value Type="Lookup">4</Value></Eq></Where></Query>
Here It will filter on ‘SomeLookupColumn’ column here based on look up id and not value.  This ensures unique value.
This can be used to get person or group also
example
Filter on Current User
Example
<Query><Where><Eq><FieldRef Name="Author" LookupId="TRUE" /><Value Type="Integer"><UserID /></Value></Eq></Where></Query>
Notice here Valuetype is integer.
Using <UserID /> as the value, the query will filter based on the current user. You can also pass the ID of a specific user in place of <UserID /> (e.g. <Value Type="Integer">283</Value>) if you don’t want to filter by the current user.
Lookup on text
Example
<Query><Where><Eq><FieldRef Name="SomeLookupColumn" /><Value Type="Lookup">GujaratState</Value></Eq></Where></Query>
This will look for items with “GujaratState” in the look up column field. If there are more than one items having same display name, it will return all those items.
Date & Time
Example
<Query><Where><Eq><FieldRef Name="Modified" /><Value Type="DateTime"><Today /></Value></Eq></Where></Query>
A date can also be used instead in Value tag.  We can also use something like this <Today OffsetDays="-4" />

Wednesday, November 11, 2015

SharePoint 2013 : Creating Document Sets




Define the allowed content types. Select from the feature request content types and add each of these documents.
Choose each of the content types to tell SharePoint what should be provisioned when the document set gets created. You may not actually want to use the same template that’s defined on the content type here in the document set. These are the default pieces of content. Remove the default content type that’s just a blank word document.
Shared columns allow me to specify which of the default Meta data could also be created on the documents themselves. Out of the Meta data we created on the document set, I’ll create everything on the welcome page. If we have any content types already based on this one we can make an update. Select yes to do the update. Click ok.

The content type and document set are ready to go. 
1. Go under library settings
2. Enable the use of content types with the management of content types on this library under advanced settings.
3. Click allow the management of content types.
4. Scroll down and click ok.



5. From here add from existing content types. Add from my feature request document sets. Click ok.
Make sure the default word document is not an option when we go to create a document set. Make it invisible by unselecting the checked box under visible. The feature request document set is now the default content for this library. Open the default all documents view and add in the referred by, the request date and the request status, so they appear on the default view.



For more

Wednesday, September 16, 2015

Backup and Restore Site Collection

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\BIN>STSA
DM.EXE -o restore -URL http://spnt-dev-sql/sites/HNB/ -filename "C:\Backups\hnbb
ack.bak"

Another site already exists at 'http://spnt-dev-sql/sites/HNB/'. Choose a new UR
L, or specify the -overwrite flag to overwrite the existing site.


C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\BIN>STSA
DM.EXE -o restore -URL http://spnt-dev-sql/sites/HNB/ -filename "C:\Backups\hnbb
ack.bak" -overwrite

<nativehr>0x80070003</nativehr><nativestack></nativestack>


C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\BIN>STSA
DM.EXE -o restore -URL http://spnt-dev-sql/sites/HNB/ -filename "C:\Backups\hnbb
ack.bak" -overwrite

Friday, September 4, 2015

Error 1 Error occurred in deployment step 'Add Solution': A feature with ID

Error 1 Error occurred in deployment step 'Add Solution': A feature with ID 15/0e0c279a-04de-41d2-813d-6059f2ef3fdf has already been installed in this farm.  Use the force attribute to explicitly re-install the feature.



--  deletesolution

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\BIN>stsadm -o deletesolution -name HNB_Circular.wsp

-- iisreset

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\BIN>iisreset

--addsolution

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\BIN>stsadm -o addsolution -filename C:\Projects\HNB_Circular.wsp

-- deploysolution

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\BIN>stsadm -o deploysolution -name HNB_Circular.wsp -url http://spm:1111/sites/hnb -immediate -allowgacdeployment

Tuesday, September 1, 2015

Workflow Manager Register Error , SharePoint 2013 on Windows 2012 R2

Microsoft SharePoint 2013 SP1, supports SharePoint installation on Windows 2012 R2 servers.

“SharePoint 2013 with service pack 1” and "Windows 2013 R2" can install without any errors.
when configuring Workflow Manager i had face many problem.

1. The most common error is “Register-SPWorkflowService The remote server returned an error: (404) Not Found”





To solve this issue we have to install
Service Bus Update
workflow manager cu 2
Before that ensure the workflow installation login should have the highest privilege as user()




























 SharePoint Designer 2013: App Management Shared Service Proxy is not installed
Standard
SharePoint Designer 2013: App Management Shared Service Proxy is not installed
Scenario:
When compiling the workflows in SharePoint Designer 2013 and publishing the workflow I faced the following Errors were found when compiling the workflow.
Further details on the error revealed Microsoft.SharePoint.SPException: App Management Shared Service Proxy is not installed.


Approach:
In order to resolve that I did the following:
Go To
  • Central Administration > Manage Services on Server
  • Check if App Manage Service is running
  • Central Administration > Application Management > Manage Service Application.
  • Check the App Management Service application is created, if not then create the App Management Service application.


Ensure: When creating the App Management Service it is important that this is enabled








Tuesday, August 25, 2015

Installing and Configuring Workflow Manager 1.0

What is Workflow Manager 1.0?

Updated: January 11, 2013
Workflow Manager 1.0 is a new server which introduces new capabilities for authoring, hosting and managing workflows. These workflows will run at high scale and density, and will support execution in a multi-tenant environment. The service builds on the successful programming model, runtime and activity library that was introduced with Windows Workflow Foundation (WF) in .NET Framework 4.
Over time, we intend to provide both a Windows Azure service capability, as well as a user-installed service capability, thereby providing user flexibility and symmetry across on-premises and Azure offerings. Initially, the capability is being made available publically as a user-installed service (for on-premises installation or installation on Azure Virtual Machines).
In addition, Workflow Manager 1.0 is used by SharePoint 2013 to run SharePoint workflows, and will be an inherent part of most Office 365 subscriptions.

Prerequisites (Workflow Manager 1.0)


Web Platform Installer checks for these prerequisites before it installs Workflow, and it automatically installs any prerequisites that it does not find. You do not need to install any prerequisites separately.
  1. .NET Framework 4 Platform Update 3 or .NET Framework 4.5
  2. Service Bus 1.0
  3. Workflow Client 1.0
  4. PowerShell 3.0
The following additional requirements must be met before you can run Configuration Wizard to configure Workflow:
  1. Instance of SQL Server 2008 R2 SP1, SQL Server Express 2008 R2 SP1, or SQL Server 2012.
  2. TCP/IP connections or named pipes must be configured in SQL Server.
  3. Windows Firewall must be enabled.
  4. Ports 12290 and 12291 must be available.

System Requirements (Workflow Manager 1.0)

SQL Server


The SQL Server instance that is used for various databases configured as a part of Workflow Manager must meet the following requirements.
  • TCP/IP, shared memory, or named pipes must be enabled.
  • Port 1443 on the firewall must be open to inbound and outbound communications.
  • If named pipes are used, the name of the machine on which the SQL Server instance is running should have a name with no more than 16 characters. Named pipes use NetBIOS names, which carry that restriction.
  • If TCP/IP connections are used, the SQL Browser service should be running on the SQL server.
  • SQL Server service should be running on the SQL server.
  • The following collation types are supported.

    • Default Collation
    • SP Collation
    • Binary Collation
  • Supported Authentication

    1. Integrated Authentication
    2. SQL Authentication

Current User

The user that is configuring Workflow Manager must meet following requirements.
  • If the machine is domain joined, the user must be a domain user; otherwise the user must be a local user.
  • The user must be an administrator on the computer on which the configuration is running.
  • The user must have SysAdmin privilege on this SQL Server instance, otherwise, the databases should be pre-created and the Sql logon for the RunAs Account User should be created manually, before running the configuration, on all Sql instances.

RunAs Account User

The RunAs account is provided during Workflow Manager configuration and is used as the RunAs account by the Workflow Manager services. The Workflow Manager supports the ability to have the RunAs account user as a domain user or a local user. In both cases, this user must have access to the SQL Server instances. Alternatively, SQL Server databases can be accessed using SQL Authentication.
The RunAs account user will be granted a log on as a service privilege during configuration.
If all the machines in a farm share the same service account and the security policy requires the service account password to be changed at regular intervals, you must perform specific actions on each machine in the farm to be able to continue adding and removing nodes in the farm. See the section titled Handling Service Password Changes for this procedure.