Showing posts with label Sharepoint. Show all posts
Showing posts with label Sharepoint. Show all posts

Wednesday, September 3, 2014

Customize SharePoint survey through UI

In SharePoint survey we don’t have option to edit the survey views and details. In my project, we need to add a column with to response to survey which works as a normal list item. This column need to save the response of the survey. I have tried to do this through UI and I am unable to do that as regular list options. I have checked it in google, few answers says that it is nearly impossible to do that through UI and we have to go for custom coding.

By checking few more links I got a clue to do that. It says that a designer workflow will collect the feedback from the user who responds the survey and workflow fills the response details to survey. That’s great. I got the fix for that.

To create new view in survey list,
  • ·         Open the new view page in SharePoint site, copy the URL to a notepad. URL shows like “/_layouts/15/ViewNew.aspx?List=%7B0C3E3AB1%2D555D%2D4FE0%2DB9B3%2DB58BE4D36D22%7D”
  • ·         Open Survey settings page, Replace the Survey list id with previous URL.


To create a new column in SharePoint survey list, Open Site with concating following URL “/_layouts/fldNew.aspx?ListID=” Add survey list ID.


These are quick hacks for SharePoint survey list. Hope this helps.

Saturday, August 30, 2014

SharePoint – Back to basics - Are sure you are SharePoint Farm Administrator?

How can I’ll be SharePoint farm Administrator? By Adding Farm Admin group from SharePoint Central Admin site as shown the below I’ll become Farm Administrator?



But as we have expected by completing all the steps, these will not grant Farm Admin privileges on the server. These steps will add user to farm admin group in SharePoint and WSS_ADMIN_WPG group in SharePoint farm. By updating user to this farm admin, users get access to web site and access to SharePoint resources as logs and web services.

If user not added in SharePoint local Admin group, user is not fully-fledged SharePoint farm administrator. When user runs SharePoint management he will see "The local farm is not accessible. Cmdlets with feature dependency ID is not registered."

To execute PowerShell commands, users need SharePoint_Shell_Access in SQL server SharePoint configuration database and other databases where we need to manage the data.

Therefore, to make a user as SharePoint farm admin, he need to have following permissions,

·      Local Administrator security group for each server in the farm
·      Farm Administration SharePoint Group
·      SQL Server SharePoint_Shell_Access database role for the SharePoint configuration database and all content databases.



Sunday, August 10, 2014

SharePoint 2013 search refinement web part

One of the most powerful web parts in SharePoint 2013 to provide search refinement experience is Search refinement web part. Search refinement web part allows users to select to refine their search results to be list a subset of results. We can modify this web part to include the properties to be appear as refiners in the search results page and also we have the option to choose the appearance of the properties like single or multiple. Depending on the data returning on the search results web part, we have the advantages to choose metadata values to be displayed. For example in a Office Management Search center, we have data to be displayed custom metadata such as Employee Job type, Designation, Department and some other default information like author details.

As shown the image below, we can see the configuration details in SharePoint Search refinement web part.




Issue with SharePoint custom workflow delay activity

While working with SharePoint custom workflow delay activity, Iam not able to run the code in delay activity. I have deleted and added new delay activity but it wasn’t worked. In general we can add user input after a particular time, we can go with delay activity in SharePoint custom workflow.

Delay activity is broken in SharePoint 2007 as well as SharePoint 2010. To fix that we have to run stsadm commands below,

stsadm -o getproperty -pn job-workflow -url siteURL

stsadm -o setproperty -pn job-workflow -pv “Every 2 minutes between 0 and 59″ -url siteURL

After running the commands, we have reset IIS and Restart the timer services in Server.

Hope this will helps.

Saturday, July 26, 2014

SharePoint migration – designer workflow runs twice every time

Migrating from SharePoint 2007 to 2013, SharePoint designer 2007 workflows migrated correctly and workflows are working as expected.

We can’t use SharePoint 2007 list template directly to create the list templates. To do that we have to save the list as a template and need to use that template to create the list.

In SharePoint 2007 site we had a workflow that sends email and update the list data depending on the details created/updated. I have attached the SharePoint designer workflow to the list. But after attaching the workflow, whenever list item added/updated to the list, it is firing twice.

After checking that some time and trail and errors I got the fix for the problem. To do that we have to pause some duration in the workflow beginning. We can make this as 1 min because the workflow timer job will take 5 min and by updating the ‘pause for duration’ value we can change the value by using job definitions in Central Administration.


Thursday, July 24, 2014

SharePoint Managed Accounts error: Managed Account could not be deleted because other objects depend on it.

After deleting all the service applications and managed account from SharePoint server by using following PowerShell commands,

Get-SPManagedAccount | Where-Object {$_.UserName -eq "Domain\Username"} | Remove-SPManagedAccount

By running the command I got an error saying that,

Remove-SPManagedAccount : An object in the SharePoint administrative framework, “SPManagedAccount Name=managed-account-S-1-5-21-2912393494-653453454-43454533245-4324″, could not be deleted because other objects depend on it. 

We can see this error because the service error we are going to delete is having dependencies. In my case iam using same account for User Profile Service.

By using following commands, we can release the dependencies on the service account.

Get-SPServiceApplicationPool | Where-Object {$_.Name -eq "User Profile Service"} | Remove-SPServiceApplicationPool

After running the command we have to delete the account by running the following command,

Get-SPManagedAccount | Where-Object {$_.UserName -eq "Domain\Username"} | Remove-SPManagedAccount


Hope this helps.

SharePoint – Delete Orphaned sites using PowerShell commands

We can delete the orphaned site in SharePoint environment that we are trying to provision the project server application. To remove orphaned site we have to un-provisioned and then delete the site.

We can delete the site by using following PowerShell commands,

Get SharePoint service application by using Get-SPServerviceApplication command
We can see the list of GUID’s. Get the service application specific to the orphaned site by using get-spserviceapplication command

$serviceApp = Get-SpServiceapplication | ? {$_.Id -eq "GUID of the Service App"}

Get the Site collection by using the service app

 $siteCollection = $serviceApp.SiteCollection

Get the site from Site Collection and delete the site by using the following commands,

$site = $siteCollection.Sitecollection | where {$_.SiteID -eq "< Guid>"}
$site.Delete()


Tuesday, June 24, 2014

SharePoint search error: Application server administration job failed for service instance Microsoft.Office.Server.Search.Administation.Search

While working with SharePoint Search, I got an error saying that “Application Server Administration job failed for service instance Microsoft.Office.Server.Search.Administration.SearchServiceInstance”.

I have changed the service application user instances and reset the index to be crawled. 
Tried to create a new search application with same search crawls and indexes. But neither was worked in my case. Digging into deep I have found this blog explain the cause and solution for problem.

We can get this error when configuration DB having older data than file system data in front end server. We can fix this issue by using the steps below,

  • Navigate to windows service and stop SharePoint Timer Services, Open SharePoint cache folder located in “C:\Documents and Settings\All Users\Application Data\Microsoft\SharePoint\Config”. Check for Config.ini file, Backup the file.
  • Delete all XML configuration files in GUID folder other than Config.ini file and double click on Cache.ini file. Select all the data and click n delete. Enter “1” (number 1), save and close the file. 
  • Start Windows SharePoint service.  Now file system will be re stored with all the configuration files in GUID folder.
It worked for me. Hope this helps.

Monday, June 23, 2014

Display loading image in SharePoint using JavaScript

To display loading image in SharePoint site We have to download the image and save it as Loading.gif and save it in SharePoint document library. Select list new item page and to be and edit the page.

Add Content Editor Web part to the page. Enter following script to the page.

<script src="../Library/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>

<style type="text/css">
   #loadImage {display:none;}
</style>

<script type="text/javascript">
function PreSaveItem()
{
  $("# loadImage ").css("display", "block");
    if ("function" == typeof (PreSaveAction)) {
        return PreSaveAction();
    }
    return true;
}
</script>

<div style="padding-top: 25px; padding-left: 30px;">
   <img width="250" height="250" id="loadImage" src="/Site/images/Loading.gif" alt=""/>
</div>

Save and close the page. Here src is the image to be loaded and enter the padding. We can see the image when page loading as shown below.


Function will be called on the List item Save event. 

Sunday, June 15, 2014

Multi domains in SharePoint 2010 people picker

In SharePoint environment people picker is one of the main part in the farm to provide the users available from all the domains to select the users. By configuring stsadm commands we can grab the users from different domains.
SharePoint will use Application pool identity to search users in active directory. If application pool account is not having permissions to do that, we have to encrypt the password.

To do that we can use following command in STSADM,

stsadm -o setapppassword -password  password

We have to set the domains should be searched on WFE for each web application,

stsadm -o setproperty -pn peoplepicker-searchadforests –pv domain:domain1;domain:domain2,domain2\account,password -url WebApplication
 
Hope this helps.



Saturday, June 14, 2014

SPGridView error: Value cannot be null. Parameter name:propName

While working with SharePoint grid view to show data, I got an error saying that “Value cannot be null. Parameter name:prop name as shown the image below.



I have checked the properties assigned to SPGridview. By default SPGrid will have option to group the result based on a column. By setting AllowGrouping is “true” we can group the data. We have to specify the grouping column name, Group collapse and Group field display name as shown the code below.

SPGridView.AllowGrouping=true;
SpGridView. GroupField=”Group Field Name”;
SPGridView.AllowGroupCollapse = false;
SPGridView.GroupDescriptionField = “Group Description Name”;
SPGridView.GroupFieldDisplayName = “DisplayName Text

We have to set GroupField, AllGroupCollapse, GroupDescriptionField and GroupFieldDisplayName along with AllwGrouping field to fix the error.

Wednesday, June 11, 2014

Display PowerPoint Presentation in SharePoint 2013 page

We can allow users to view Office web apps in SharePoint 2013 with in the browser by clicking on the link of document. We can display PPT in browser. First of all create and upload a PPT to document library by selecting New Document, Select “PowerPoint Presentation” as shown the image below.



Select the PPT URL by clicking on the … next to PPT document, select and copy the URL. Navigate to the page where we need to display the PPT and insert Page viewer web part as shown below.



Edit the web part, enter the URL in Page Viewer link in web part properties. In Appearance tab select “YES” for “should the web part have a fixed height”, and set it as 600 px. Save and close the properties.



Now we can see the PPT in the page as a web part and will have options to navigate the pages in PPT.

Saturday, May 17, 2014

SharePoint 2010 installation Error – Could not create Configuration database

While installing SharePoint, I got an error saying that “Could not create Configuration database - Failed to call GetTypes on assembly Microsoft.Office.InfoPath.Server, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c The system cannot find the file specified. Could not load file or assembly 'Microsoft.Office.InfoPath, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies.

I have rechecked pre-requisites and re-installed all the pre-requisites. But still Iam facing the same issue. By checking the issue in deep I have found that issue is related to InfoPath. In my machine Iam having InfoPath 2013. It’s blocking SharePoint Configuration wizard to create database.

To fix this issue we have to uninstall InfoPath from current machine. After uninstalling the InfoPath Configuration wizard ran successfully.

Hope this helps.

Friday, May 16, 2014

SharePoint – Back to Basics – SharePoint URL field link open in new window using JavaScript

One my project I got a requirement that in SharePoint URL field we have to open the link in new window. But URL field, we don't have option to open the link in new window through UI. For that I have added custom JavaScript in Content editor web part/Script web part.

Before updating JavaScript we have to add #Opennewtab at the end of the URL in URL field as Show the image below.



Add following JavaScript to the List items page through Content Editor web part/ Script editor web part.

<script language="JavaScript">
_spBodyOnLoadFunctionNames.push("UpdateLinks");
function UpdateLinks() {
var anchorsTags = document.getElementsByTagName("a");
for (var x=0; x< anchorsTags.length; x++) {
if (anchors[x].outerHTML.indexOf('#Opennewtab)>0)
{
                oldText = anchors[x].outerHTML;
                newText = oldText.replace(/#Opennewtab/,'" target="_blank');
                anchors[x].outerHTML = newText;
}
}
}
</script>

After adding this script save and close the web part. All the links added with #OpeninNewtab will be open in new window.

Thursday, April 10, 2014

SharePoint 2013 wsp upgrading error: Cannot uninstall Language Pack 0 because it is not deployed when attempting to uninstall-spsolution.

While updating a wsp in SharePoint 2013 environment I got an error saying that “Cannot uninstall Language Pack 0 because it is not deployed when attempting to uninstall-spsolution.” As shown the image below.



By checking the solution in farm solutions (Central Administration -> System Settings -> Manage Farm Solutions) Solution wasn’t deployed. I have found this blog explaining the issue. The reason for this error is that DLL’s in the GAC were not able to delete. So I have deleted the DLL’s in the GAC and deployed through SharePoint central Administration

If it is timer job, We have to Stop and SharePoint timer services in the services.

Hope this helps.


Monday, March 24, 2014

Upgrade workflow in SharePoint environment

While working with SharePoint workflows I have a scenario to upgrade the logic for workflow. But there are many items already running on the existing workflow. So new workflow shouldn’t override on existing. We need to create an upgrade for existing workflow.

TO do that we have to follow the steps below,
Change Workflow assembly version number by right clicking on the workflow project, In Application section, Click on Assembly Info button. Change Assembly Version number and file version number in Assembly information























Update the assembly version number in workflow.xml file workflow element. Change the Solution ID in the manifest.xml file

Change .wsp name. For example we have Site.DataRequestWorkFlow.wsp previously, update it to Site.DataRequestWorkflowV1.wsp.

Deploy new wsp file using PowerShell commands or stsadm commands and we have to Run IISReset command


Change the old workflow to not allowing any new instances and disable the options to start manually or Item created. By doing this there will not any new instances for old workflow. Create a new workflow association using new workflow that deployed.

Monday, March 17, 2014

Update UserProfile properties in using SPServices in SharePoint

I got a requirement to update the User Profile properties for one of my client. We have only option to do that using SPServices because they are not allowing any server side code. In SPServices we can directly update the user profile services using “ModifyUserPropertyByAccountName” method. By passing current logged-in user account to the method we can update the user profile properties using SPServices. I have found the following code from here (http://azzu-sheikh.blogspot.in/2014/01/update-user-profile-property-through.html)to update the user profile service.

function updateUserProfileProperty(currentLoggedInUser, propertyName, propertyValue) {
   var propertyData = "<PropertyData>" +
  "<IsPrivacyChanged>false</IsPrivacyChanged>" +
  "<IsValueChanged>true</IsValueChanged>" +
  "<Name>" + propertyName + "</Name>" +
  "<Privacy>NotSet</Privacy>" +
  "<Values><ValueData><Value xsi:type=\"xsd:string\">" + propertyValue + "</Value></ValueData></Values>" +
  "</PropertyData>";

   $().SPServices({
       operation: "ModifyUserPropertyByAccountName",
       async: false,
       webURL: "/",
       accountName: currentLoggedInUser,
       newData: propertyData,
       completefunc: function (xData, Status) {
           var result = $(xData.responseXML);
           if (Status == "success") {
              //do update action
           }
       }
   });
}


We can change the user property details by getting property data in to the method and passing the current logged-in user account details as shown the code above.

Friday, March 14, 2014

Change SharePoint site time format


In SharePoint calendar by default we can see the view as Day/week in 12 hour format, not in 24 hour format. We can to change the format from 12 hour to 24 hour through UI or using PowerShell commands.

We can change that through UI by following steps,

Navigate to SharePoint Site settings page and in Site Administration section click on “Regional settings” link



In Time format drop down select 24 hour format. Click on ok to save the settings.


We can change the format using following Powershell commands,

$site = Get-SPSite <SiteCollectionURL>
$web = $site.OpenWeb()
$web.RegionalSettings.Time24=$True
$web.RegionalSettings.FirstDayOfWeek=1
$web.Update()
$web.Dispose()
$site.Dispose()


Wednesday, March 12, 2014

Check current logged-in user having permissions to specific group in SharePoint SPServices

We can check the groups for current logged-in user from SPServices code using “GetGroupCollectionFromUser” opration. Before the we have to download and add folowing files. Javascript 1.7.1.js and JQuery.SpServices-0.7.1a.min.js

Following script will used to get the user group details

$().SPServices({
operation: "GetGroupCollectionFromUser",
userLoginName: $().SPServices.SPGetCurrentUser(),
async: false,
completefunc: function (xData, Status) {
var count = 0;
$(xData.responseXML).find("Group").each(function () {
if ($(this).attr("Name") == "Group Name") 
count++; 
}
 }); 
if (count == 0) {
// do some action
}
else {
// do some action
}
}
});

Sunday, February 23, 2014

Get list of all users in a site collection and get all the web parts in a page

We can get the list of all users and web parts in a page by entering the URL of the site with addition of text. We can get all the users by appending “_layouts/people.aspx?membershipGroupId=0” text. We can get all the users in a Site collection as shown the image below. We can have settings for the list of the users.


We can see the Actions for the users as shown the image below.


We can the list of all the web parts in a page by appending “?contents=1” text to Url of the site. It will navigate to SharePoint web parts maintenance page. We can have option to close the web parts, reset and delete the web parts from the page.