Deploy Provided Hosted App In SharePoint Online (O365) -Part1

Deploy Provided Hosted App in SharePoint Online (O365)

There are three section we need to configure to make it work i.e. Provided Hosted App in SharePoint Online.
1. Create Visual Studio Project using SharePoint Add in Template
2. Create Azure Web App for Hosting purpose​
3. Generate the Client Id and Client Secret using https://<<SiteCollection>>/_layouts/AppRegNew.aspx
4. Set generated client Id and Client Secret in VS Solution Web.Config.
5. Set Client Id and Client Secret in Azure Web App using Old Portal.
Step 1
Preferable: Launch Visual Studio 2015 

 
Step 2:-
Give SharePoint site URL and Select Provided Hosted App and click Next

 
Step 3
Provide the user name and password and Sign In and Click Next

 

Step 4
Select SharePoint Online and click Next

 

Step 5
Select ASP.Net MVC with Web Application and click next

 

Step 6
Select Window Azure Access Control option and click Finish.
 


Step 7
You need to host the Provided Hosted App in to Azure
Login to Http://portal.azure.com
If you have subscription login with that else you can create the new account which give one month free subscription.
Select New -> Web + Mobile (under Market place) -> Web App (under Featured Apps)
 

Step 8
Enter App Name, Select Subscription, Create or use existing Resource Group, Select Service Plan and click create.
 

Step 9
Now user will automatically navigate to newly created Web App Setting Page. Click on the Get Publish Profile. Now you are ready with Web App.

 

Step 10
I logged in to my developer site and navigate to https://<<SiteCollection>>/_layouts/AppRegNew.aspx
Click on the generate button for client Id and Client Secret and Give the Title of the application. It can be abc.
App Domain and Re-direct URL is important.
App Domain: - Copy the Azure Web App URL without http://
Redirect Url:- Copy the Azure Web App URL with Https://
Click on the create and you are good to go with Client Id and Client Secret.

 

Step 11

After click create, you will redirect to below page. Save the Client Id and Client Secret somewhere else also. It will come into use multiple places.
 

Step 12

Add Client Id and Client Secret to Web.Config which was generated in step number 11

 
Step 13

Select App Manifest.xml file and assign the read only permission to Web scope.
 

Step 14

Publish the Visual Studio solution and Import already created profile of Web App
 ​
Step 15

Browse the earlier downloaded profile of Web App (Step 9) and It will set automatically all properties.
Important:- Change the Destination url with Https instead of http
Click Next -> Publish.
 

Note:- After Publish your web app will open and show the error message.
 

SiteCore 8.1- Not able to add file in layout folder using Sitecore Rocks

When i tried to add aspx file in the layout folder using Sitecore Rocks, getting below error

Issue:-




Resolution:- 

  • Open Bin folder of your webRoot (e.g. C:\Inetpub\wwwroot\Website\bin)
  • If the assembly is not in Bin folder, Go to "c:\Users[username]\AppData\Local\Microsoft\VisualStudio\11.0\Extensions\" folder. Then, there would be some folders and find the assembly in one of folders.
  • Copy ”Sitecore.Rocks.TemplateWizard.dll” and paste it to “C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies”
VS 2013 Edition Path:-

  • Open Bin folder of your webRoot (e.g. C:\Inetpub\wwwroot\Website\bin)
  • If the assembly is not in Bin folder, Go to "C:\Users\[username]\AppData\Local\Microsoft\VisualStudio\12.0\Extensions\3fb0b2i1.enx" folder. Then, there would be some folders and find the assembly in one of folders.
  • Copy ”Sitecore.Rocks.TemplateWizard.dll” and paste it to “C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies”.

Happy Coding

File Explorer Missing in Sitecore 8.1

File Explore didn't find in site core 8. It seems like missing


Alternative:-

The File explorer can be opened up in site core 8 using below url:-

http://[site core instance]/sitecore/shell/default.aspx?xmlcontrol=fileexplorer



KB article:-http://www.newguid.net/sitecore/2015/sitecore-8-enable-developer-center-xpath-builder-file-explorer/

Happy Coding

CSS failed to load in Sitecore window 10

I installed SiteCore 8.1 in window 10 machine. After completing all configuration.


1. .Net Framework4.5
2. IIS 7
3. SQL Server
4. Site Core

SiteCore site start browsing but it seems like CSS didn't load. I tried in multiple browser and with all default script setting - All setting was ok.

I followed below steps and working fine:-

1. Enable the Static Content feature of iis.
 Go to Control panel -> Programs and Features -> Turn Windows feature On or Off ->



2. Expand IIS -> World Wide Web Services
   Enable or select  Default Document, Direct Browsing, HTTP Errors, Static Content.




Click ok  and wait for update.
Browse the site  - It start working fine.


Happy Coding.

SharePoint 2013 Search Modify the Item Display Template

SharePoint 2013 Search Add Managed Property in Item Display Template

Item display template can be modified using Managed Property - We can add or remove the managed property and modify as per requirement.

How to access the Item Display Template , I explained in my earlier post here

Each Search display template contains default managed properties. They appear in the <mso:ManagedPropertyMapping> tag at the top of each template: 

Each Template have one-one mapping of property like:-




Take the  copies of the templates or modifying existing ones
To add a new managed property, simply add another entry. For example, if I had a managed property named "Country", I would add 'CountryOWSText':'CountryOWSText', to the <mso:ManagedPropertyMapping> tag:
If you have uploading the template to different site - Remember to change the url also.






Use the Managed Property, where you want to change the display the Template like below:-

Save the changes and upload the template in Display Template -> search folder and refer the same file in Search Result Web Part.

Click Ok  and publish the page and Search Result web part will start appearing as per our design.




Happy Coding..

Custom Refiner in SharePoint 2013 Search

This article describe - How to add custom refiner in SharePoint 2013 Search, How to make the enrich search.

OOTB search result page with OOTB refiners:-



Refiners work with Manager Property, All above property i.e. Result Type, Author & Modified Date are Managed Property.

Refiner is also a search refiner web part - through which we can existing managed property - Follow the below steps for adding more properties:-

Step 1:- Edit the Page and Edit the Right hand side refiner web part.




Step 2 :- Edit the Web Part and click the choose refiner



Step 3:- Select the managed property from LHS list box and add to RHS  like Region, Country, Site

By default standard or naming convention of managed property Site Column Name + OWS + Data Type. I have created the Region, Country, Site as site column with Single line of text.
Similarly we can rename the Display Name , apply the template, sort the property etc.




Step 4 :-  How to get the managed property -  Go to Site Setting -> Site Collection Adminsitration -> Search Schema.


Step 5:- By Default Managed Property select - Search for Site Column i.e. region as highlighted below, I got the managed property i.e. RegionOWSText and Edit the property and set Query, Search, Refine if not selected as shown below:-



Step 6 :- After step 4 just click ok and save the page - you will get custom refiner in your search result page-



Happy Coding


Deployment Steps For InfoPath Form During Migration


  • SharePoint Enterprise Edition 2013
  • Microsoft InfoPath Designer 2013
  • An account to access the SharePoint 2013 Site as Site Collection Administrator
  • Visual Studio 2012


Step 1 :- Open InfoPath Form:

Open the 2007 InfoPath template (XSN file) with InfoPath Designer 2013

Step 2 :- Go to Form Options:

File->Options->Form Options

InfoPath1.png 

Step 3:-Set Full trust for the form Security and Trust

 InfoPath2.png
Step 4:-Set Code path and Target Version for InfoPath.

In Our case we had a code behind for the InfoPath form, so set the project file under Programming.
Target of the Form should be InfoPath in the Target dropdown.

InfoPath3.png 

Step 5 :- Change Compatibility

Change the Form type from Web Browser Form (InfoPath 2007) to Web Browser Form and set the Url of the site.

InfoPath4.png 

Step 6:- File -> Publish-> SharePoint server
InfoPath5.png 


Step 7:- Give the URL of the site where this form needs to be published.

InfoPath6.png 
  
Step 8 :- Click on next and select Administrator-approved form template

InfoPath7.png 


Step 9 :- Click Next, Configure the path where the form needs to be published

InfoPath8.png 

Step 10:- Click Next

InfoPath9.png 

Note: User can modify the InfoPath fields here, if required.

Step 11:- Click Publish

InfoPath10.png 

Step 12:- After its successfully published, click Close

InfoPath11.png 


Command to deploy the form to central admin (as earlier it was deployed to central admin)
Install-SPInfoPathFormTemplate -Path "Path of the xsn file"
Enable-SPInfoPathFormTemplate -Identity "Agreement Form.xsn"  -Site "SiteCollectionUrl"

If you want to re-deploy in the same farm, follow these commands:

  1. Disable-SPInfoPathFormTemplate -Identity "Formname.xsn" -Site "SiteCollectionUrl"
  2. Uninstall-SPInfoPathFormTemplate -Identity "Formname.xsn"
  3. Install-SPInfoPathFormTemplate -Path "Path of the xsn file"
  4. Enable-SPInfoPathFormTemplate -Identity "Agreement Form.xsn"  -Site "SiteCollectionUrl"



Form will be deployed to Central Admin.

Challenges faced during InfoPath form Migration from Moss 2007 to SharePoint 2013

Challenge 1:
During Migration from Moss 2007 to SharePoint 2013 - all  old infopath forms that exists in Form/Document  library were opening /working  with new InfoPath 2013 form, but People picker does not contain any value.

Note:-
This is due to schema structure of People Picker control has changed from Moss2007 to SharePoint 2013.

Resolution:
Since the people picker in InfoPath 2013 is changed, we had to add extra namespace to all people picker tags in the InfoPath xml files in the library.

Example: Project manager people picker was not having any value in the form.
Before adding namespace
<my:project_manager>
<my:Person>
<my:DisplayName>xyz</my:DisplayName>
<my:AccountId>domain\xyz</my:AccountId>
<my:AccountType>User</my:AccountType>
</my:Person>
</my:project_manager>

After adding namespace
<my:project_manager>
<pc:DisplayName>USer Dispaly Name</pc:DisplayName>
<pc:AccountId>Domain\user</pc:AccountId>
<pc:AccountType>User</pc:AccountType>
</pc:Person>
</my:project_manager>

Once the above change has been done to all old xml files using PowerShell script, People Picker started working fine.

Challenge 2:

In continuation of above Custom Migration from Moss 2007 to SharePoint 2013  article:-

I need to deploy the custom workflow which was associated with Info Path Form. As I migrated info path and workflow successfully. It was not working as expected.

​After doing lots of R&D, I got the solution and explained below:-

Resolution:

In the Nutshell :- Custom Workflow code was using an entity class file auto generated for InfoPath XSD file. As People Picker control scheme has changed from Moss 2007 to SharePoint 2013. So I need to update the entity class accordingly.

Generating new entity class
To generate the entity class for .xsd file we need to use the XML Schema definition tool (Xsd.exe)
Reference links:

Once you have the SDK Installed(either Manually, or with Visual Studio), you'll find it in the following directories:
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools

Run the command as
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools>xsd.exe
/c /l:cs myschema.xsd BuiltInActiveXControls.xsd

Note: myschema.xsd is file name of InfoPath and BuiltInActiveControls.xsd was needed for new people picker in InfoPath 2013

This will generate the entity class for the .xsd file of InfoPath. Then replaced this with old entity class carefully and check if only people picker classes has changed and deployed the solution.
Now workflow started working as expected.

Note: 
Resolving Issue with People Picker In InfoPath Form

​Since picker schema in InfoPath 2013 has changed, so we have to remove existing people picker and add new people picker from InfoPath 2013 also.