Showing posts with label SharePoint 2013. Show all posts
Showing posts with label SharePoint 2013. Show all posts

September 5, 2017

Uninstall SharePoint 2013 - One or more required office component failed to complete successfully.

Issue:
While uninstalling SharePoint Server 2013, you may get below error message.

Error:
"One or more required office component failed to complete successfully. For more information, consult the setup log file." as shown in below screenshot.
 

Resolution: To fix the issue follow below steps:
 
1. Go to your Database Server.
2. Go to Services section:- Go to Run (Windows + R) and type "services.msc".
3. Stop the following services:
  • SQL Full-text Filter Daemon Launcher (MSSQLSERVER)
  • SQL Server (MSSQLSERVER)
  • SQL Server Agent (MSSQLSERVER)
  • SQL Server Analysis Services (MSSQLSERVER)
Again go to Control Panel and uninstall SharePoint 2013, you will not get this error this time.

In case, if you reinstall SharePoint server, do not forget to restart all those services.

If you have any questions you can reach out our SharePoint Consulting team here.

July 31, 2017

SharePoint 2013 - Managed Metadata Navigation is not visible to Anonymous and Read Permission Users.

Scenario:
Managed Metadata service Application lets you define your site navigation using term sets. It lets you tag your content with term sets making structure of your content relevant. But, you might wind up in situation wherein users having Read Permission or Anonymous users are not able to see the Managed Metadata navigation. This issue crops up due to "" being selected in Navigation tab for the term. If you want to rid yourself of this issue, you have two options:

Option #1: You can either change it to "Simple Link or Header in Navigation tab"  
                                                                 OR
Option #2: You can set your target page in " " in Term-Driven Pages tab and save the settings, this issue should go away.

Steps for both approaches are summarized below:

Step 1: From your Site Collection, go to Term Store Management Under Site Administration from Site Settings.


Step 2:
 - If you want to go for Option #1 as resolution, under your Term Set -
     - Select your Term.
     - Select "Navigation" Tab in right panel.
     - Select "Simple Link or Header" under Navigation Node Type section.
     - Click "Save".


 - If you want to go for Option #2 as resolution, under your Term Set - 
     - Select your Term.
     - Go to Term-Driven Pages tab and set page for Change target page for this term after checking the checkbox and click Save.

Step 3: Do the same steps for all the terms that are invisible to Anonymous and Read only users.




If you have any questions you can reach out our SharePoint Consulting team here.

June 16, 2017

How to escape a special character in filter parameter using REST API

Scenario: 
Recently working with REST API to get items from SharePoint list filtered by title field, I got stuck. it was working fine while having data without special character. But having special character - single quote/apostrophe (') in filter parameter was giving an error. I tried by passing value using EncodeURIComponent, but it didn't work either and getting the error as shown below:


Reason: 
EncodeURIComponent, Escape or EncodeURI functions can’t escape few special characters: - _ . ! ~ * ' ( )
 
Solution:
For such special characters as filter parameter, we should double the character (2 single quotes) and use it.

Example:
Non-working REST API:
https://{Site URL} /_api/web/lists/GetByTitle('listname')/items? select=ID&$filter=Title eq 'what's up'

Working REST API:
https://{Site URL} /_api/web/lists/GetByTitle('listname')/items? select=ID&$filter=Title eq 'what''s up'

If you have any questions you can reach out our SharePoint Consulting team here.

Create a subsite programmatically using Custom Site Template through SharePoint JavaScript Object Model and REST API

Here, I'll explain you in detail how to create SharePoint sub-site programmatically using custom Site Templates through JSOM and REST API.
 
Implementation Approach: First, we need to identify Web Template Id for our custom template. programmatically. And then, we will a create sub-site using the Web Template Id.

Let's go through the code snippet, now. We have two functions in code snippet:

1. CreateSubsiteByTemplateName(title, description, webUrl, templateTitle) 
- This function will create a sub-site by Template Name. First of all, it will find out the Template Id from Template Name, and then, will call another function to create the sub-site.
Parameters Information:
    1. title= name of sub-site which you want to create Ex: "subsite1"
    2. description = description for sub-site
    3. weburl = URL for sub-site Ex: "subsite1"
    4. templateTitle= Name of custom template Ex: "Physicians"

2. CreateSubsiteByTemplateId(title, description, webUrl, templateId)
- This function will create a sub-site by Template Id.
Parameters Information:
    1. title= name of sub-site which you want to create Ex: "subsite1"
    2. description = description for sub-site.
    3. weburl = URL for sub-site Ex: "subsite1"
    4. templateId= Id of custom template Ex: "{D5729655-B3D8-4DED-B5E9-3EE09934FC80}#Physicians"

Code Snippet 1:
 function CreateSubsiteByTemplateName(title, description, webUrl, templateTitle) {   
   var context = new SP.ClientContext.get_current();   
   var web = context.get_web();   
   context.load(web);   
   var webTemplates = web.getAvailableWebTemplates(1033, false);   
   context.load(webTemplates);   
   context.executeQueryAsync(function () {   
    var enumerator = webTemplates.getEnumerator();   
    var templateId = "STS#0";   
    while (enumerator.moveNext()) {   
     var webTemplate = enumerator.get_current();   
     var webTitle = webTemplate.get_title();   
     if (webTitle == templateTitle) {   
      templateId = webTemplate.get_name();  
      break;   
     }   
    }   
    CreateSubsiteByTemplateId(title, description, webUrl, templateId);   
   },   
    function (sender, args) {   
     alert(args.get_message())   
    }   
   );   
  }  

Code Snippet 2:
 function CreateSubsiteByTemplateId(title, description, webUrl, templateId) {    
   var restAPIURL = "/_api/web/webinfos/add";    
   var newSiteData = JSON.stringify(    
   {    
   'parameters': {    
    '__metadata': {    
    'type': 'SP.WebInfoCreationInformation'    
    },    
    'Url': webUrl,    
    'Description': 'Subsite created from REST API',    
    'Title': title,    
    'Language': 1033,    
    'WebTemplate': templateId,    
    'UseUniquePermissions': true    
   }    
   });    
   $.ajax    
   ({    
   url: restAPIURL,    
   type: "POST",    
   async: false,    
   data: newSiteData,    
   headers: {    
    "accept": "application/json;odata=verbose",    
    "content-type": "application/json;odata=verbose",    
    "X-RequestDigest": $('#__REQUESTDIGEST').val()    
   },    
   success: function (data) {    
    console.log('site created');    
   },    
   error: function (data) {    
    console.log('Error creating site');    
   }    
   });    
  }    

If you have any questions you can reach out our SharePoint Consulting team here.

January 4, 2017

Mail Address not getting synchronized in SharePoint 2013

People might have stumbled upon issue of mails not getting synchronized in SharePoint 2013 and might be wondering why is it so and how do we fix it? Here, I'll walkthrough in detail in order to fix the issue.
 
Cause: this issue is raised because User Profile Service application is trying to sync Work Email with AD attribute "proxyAddresses" instead of "mail" attribute.

First of all, make sure User Profile Service and User Profile Synchronization Service are started.

Now, follow below Steps:
  • Go to User Profile Service Application:
    • Manage Service Applications --> User Profile Service Application.
  • Click on the "Manage User Properties" under People section.
                                     
  • In Manage User Properties page, navigate to "Work email" property under Contact Information section. Click on Edit.
  • In Edit User Profile Property page, Navigate to Property Mapping for Synchronization section, and remove proxyAddresses mapping.
 
  • Now, Go to Add New Mapping section, and select "mail" from Attribute drop down and click on Add.
  • You can see "mail" attribute in Property Mapping for Synchronization section.
  • In Edit User Profile Property page, click on OK to apply changes.
Start Full Synchronization and wait for Profile Synchronization Status to get "Idle". Now, you can search for any profile on Manage User Profiles page, you will see mail addresses will be filled in for users.


If you have any questions you can reach out our SharePoint Consulting team here.

November 22, 2016

SharePoint 2013/SharePoint 2010: Service Unavailable - HTTP Error 503. The service is unavailable.

Issue:
Sometimes we get error in SharePoint 2010 or SharePoint 2013 like "Service Unavailable - HTTP Error 503. The service is unavailable" when we try to access a SharePoint site.



Cause of the issue:
IIS - Application Pool of specific Web Application is Disabled/Stopped.

Resolution Steps:
Important Note: If SharePoint Farm is multi tier farm, then, below steps need to be verified in all web servers.

1. Login to SharePoint Server as administrator.
2. Open Internet Information Services (IIS) Manager.
3. Navigate to Application Pools option under server name as shown in below screenshot. And verify that Application Pool for specific web application is in "Started" status. In screenshot, we can see that status of specific Application Pool is stopped.


4. Right click on this Application Pool and click "Start".
5. Open the site in browser and it should work as expected.


If you have any questions you can reach out our SharePoint Consulting team here.

October 19, 2016

How to create Custom action to deploy with Sharepoint Add-ins(Apps)

There are two basic types of SharePoint Apps/Add-ins: SharePoint Hosted and Provider Hosted. Here, I will show how we can create custom action in host web document library through SharePoint Add-ins and open a model popup on click. Follow below steps:

Step 1:
Open your SharePoint App project in Visual Studio Solution. Add New Item, select Ribbon Custom action and give it name and click on Add.


Step 2:
Now in second dialog box, we have to set properties for custom action. In Dialog box. Select appropriate option based on requirement. Here, I have selected custom action scope to "List Template" and custom action scope location set to "Document Library" and click on Next.

You can select any type like Custom List, Calendar, Form Library etc.


Step 3:
Now in third dialog box, we have to specify the settings to generate a button control for ribbon. Here, I have selected "Ribbon.Documents.EditCheckout" as control location (Ribbon group where you would like to put the Control), "Demo Modal" as button control text (Name of your Control), and provide default page URL where button control navigates. Click on Finish. Now, custom action is created.


Step 4: 
Open Elements.xml file and add following attributes in <CustomAction> tag.

                HostWebDialog="TRUE"
                HostWebDialogWidth="600"
                HostWebDialogHeight="400" 


Your Elements.xml file looks like below

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction Id="26a48039-5fc9-45fc-aabb-287b3ccedd3f.Demo_Modal"
                RegistrationType="List"
                RegistrationId="101"
                Location="CommandUI.Ribbon"
                Sequence="10001"
                HostWebDialog="TRUE"
                HostWebDialogWidth="600"
                HostWebDialogHeight="400"
                Title="Demo Modal">
    <CommandUIExtension>      
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.Documents.EditCheckout.Controls._children">
          <Button Id="Ribbon.Documents.EditCheckout.Demo_ModalButton"
                  Alt="Demo_Modal"
                  Sequence="100"
                  Command="Invoke_Demo_ModalButtonRequest"
                  LabelText="Demo_Modal"
                  TemplateAlias="o1"
                  Image32by32="_layouts/15/images/placeholder32x32.png"
                  Image16by16="_layouts/15/images/placeholder16x16.png" />
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler 
          Command="Invoke_Demo_ModalButtonRequest"
          CommandAction="~appWebUrl/Pages/Default.aspx?{StandardTokens}&amp;
          SPListItemId={SelectedItemId}&amp;SPListId={SelectedListId}&amp;SPListURLDir=      {ListUrlDir}&amp;SPSource={Source}"/>
      </CommandUIHandlers>
    </CommandUIExtension >
  </CustomAction>
</Elements>

Step 5:
Now open navigation page (App Page - default.aspx) of custom action and add below code:
<WebPartPages:AllowFraming ID="AllowFraming" runat="server"/>

All done! 
 
Now, we can deploy app in SharePoint and custom action will be created. It will open Modal Popup on click of "Demo_Modal".
 
Deployed app will looks like above Image. This is a great way to extend functionality of SharePoint.

If you have any questions you can reach out our SharePoint Consulting team here.

September 30, 2016

How to setup multilingual site in SharePoint with Google Translatation

Introduction
There are multiple ways to implement multilingual sites in SharePoint, like MUI, Variation, Google Translate. Here, I will explain the basic concept of these 3 options that can be used which suites our requirements.

1. Multilingual User Interface(MUI)
This option creates a site in default language that is selected while creating a Site. For example, if the Chinese language is selected when the site was created, the site user interface will appear in Chinese. We need to add different language pack and configure site for multiple languages.
Limitations:
It only affects the site administration pages and OOTB SharePoint navigation, welcome message, column headers etc. But it doesn’t support user-created content, such as list item data, documents and web pages in libraries, custom permission levels, and custom groups. Also, it requires publishing feature, and thus requires SharePoint Server license. it won't work with SharePoint Foundation.

2. Variations
When variation is enabled, SharePoint will automatically build a variation of the site in parallel. This option creates a source variation site that is used to author content in one language, and then it will sync that content to one or more target variation sites in other languages. For example, you can author and publish content in English language for http://yoursitename.com/en, and use variation to sync content to http://yoursitename.com/fr, where it can be translated into French.
Limitations:
SharePoint creates two alternate versions of the site as you build out the structure of the source site. This option basically increases the content DB size as it creates new site collection for each variation. It can’t translate any content you build on the source site. You will need to recreate the content from the source site to variation site. It also requires publishing feature, hence can work only with SharePoint Server.

3. Google Translation
The 3rd option while creating a multilingual site is using the machine translation tool. Google Translation is free option for language translation tool for SharePoint. The SharePoint site is run through a translation engine and re-rendered in selected language. It works with SharePoint foundation, too. Here, we will see how we can convert whole SharePoint site content in preferred language.

How to implement multilingual site using Google Translate:

I have created a WSP package in SharePoint solution which contains:
1. User Control - For a dropdown control which contains a list of available languages.
2. JavaScript - To translate the content in other languages.
3. Custom master page – to add control in it, so that the translation control will be available throughout the site.


Step 1:
Create a user-control(.ascx) with dropdown list through which user can select a language to translate site content. Here, I have added only few languages, but we can add as many as needed.
e.g.
<li role="presentation"><a href="#" data-lang="Indonesian" role="menuitem" tabindex="-1">Indonesian </a> </li>


 
<div id="google_translate_element" style="display: none !important;"></div>
<div class="dropdown" style="margin: 0px; text-align: right; padding-right: 0px;">
<!-- Use CSS to replace link text with flag icons -->
<a class="dropdown-toggle" id="translatebutton" data-toggle="dropdown" aria-expanded="true"><!--<img/>--> Translate </a>
<div class="dropdown-menu dropdown-menu-right translation-links" role="menu" aria-labelledby="dropdownMenu1" id="translateblock">
<div id="translateblocknotice">Select your language </div>
<ul class="col-md-3 col-xs-6 translateblockcolumn">
<li role="presentation">
<a href="#" data-lang="English" role="menuitem" tabindex="-1"> English </a> </li>
<li role="presentation">
<a href="#" data-lang="Afrikaans" role="menuitem" tabindex="-1"> Afrikaans </a></li>
<li role="presentation">
<a href="#" data-lang="Albanian" role="menuitem" tabindex="-1"> Albanian </a> </li> <li role="presentation">
<a href="#" data-lang="Swahili" role="menuitem" tabindex="-1"> Swahili </a> </li> </ul>
</div>
</div>


<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s=" crossorigin="anonymous"></script>
<script src="http://translate.googleapis.com/translate_static/js/element/10/element_main.js" type="text/javascript"></script>
<script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit" type="text/javascript"></script>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en', layout:
google.translate.TranslateElement.InlineLayout.SIMPLE
},
'google_translate_element');
}
</script>

<script type="text/javascript">
$('.translation-links a').click(function () {
var lang = $(this).data('lang');
var $frame = $('.goog-te-menu-frame:first');
if (!$frame.size()) {
alert("Error: Could not find Google translate frame.");
return false;
}
$frame.contents().find('.goog-te-menu2-item span.text:contains(' + lang + ')').get(0).click();
return false;
});
</script>


Step 2:
Now, open master page and reference the user control we have created. After adding the user control, master page will look like:

<div class="col-lg-6 col-xs-5" id="translate">
<!--SPM:<%@ Register TagPrefix="ucTranslator" TagName="Translator" Src="~/_controltemplates/15/MyProject/Translator.ascx" %>-->
<!--CS: Start Create Snippets From Custom ASP.NET Markup Snippet-->
<!--SPM:<ucTranslator:Translator runat="server" id="Translator"/>-->
<!--CE: End Create Snippets From Custom ASP.NET Markup Snippet-->
</div>


Step 3:
Build and deploy the solution.

Results
As shown in below image, you can see Translate link on top of the page. Click on Translate link and select any language, site content will be translated in the desired language.


On clicking Translate link, it shows available languages content can be translated into.
Selecting Chinese language, content will be translated as shown below.



The limitation of this approach is, it won’t work with left to right language like Arabic. It will just convert the content in Arabic language.  "Variation" is the option if you want entire site to be translated from Right to left through.

If you have any questions you can reach out our SharePoint Consulting team here.

September 8, 2016

Access Web App – Related Items Control - Parent/Child data in a Single View



Introduction

Today, I'll guide you through in detail how we can display and manage related data from 2 different tables, having parent/child relationship in a single view in SharePoint 2013 - Access Web app.
 
First, Create two tables: "Country" and "State". Now, if we want to view all States of the specific Country in Country Table View. That’s where the Related Item Control comes into picture!! Here, If you navigate to a record in Country table, you’ll see all States of that Country. You can also add other new States for that country from the same view.



Here are the steps to achieve the functionality:
  • Create "Country" and "State" tables with required fields in MS Access 2013.
  • For Country reference, add a lookup column which points to country name field in Country table, here it is ‘CID’.


  • Now, you can add data in Country and State tables and publish the app in SharePoint 2013. You can also insert same data from SharePoint List.

  • Country list view will look as below after adding data.
  • Add another control on list view called “Related Items Controls”, to show related state details on Country list view.
  • Configure it to display related state data as shown below.




  • Save view and launch the app.
  • Here, we can add new state details and/or also edit existing state data from this view.

If you have any questions you can reach out our SharePoint Consulting team here.