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

Thursday, September 4, 2014

InfoPath error – “Your user name or group membership cannot be verified because the form's security settings do not permit it.”

Working with existing InfoPath forms, while opening the form it is showing error as “Your user name or group membership cannot be verified because the form's security settings do not permit it.” As shown the below.



 We can get this error due to form security error. To fix that we need to add the site to local sites by using the steps below.

Navigate to IE and open Internet Option from IE settings.


In the Security Tab, Select “Local Intranet” option and click on Sites button.


You can see “local Intranet” popup, click on “Advanced” button.


Add the Site to local intranet sites by clicking on Add button. Click on Close button.


Click on Ok button to Save “local Intranet” popup and Ok button to close internet options.

By opening the form we can see the form without any errors. Hope this helps.

Sunday, August 31, 2014

SharePoint 2013 – office 365 site save site as template error

In Office 365 site, to save customized site as template we can’t have save site as template option as we don’t even activate publishing feature. For example, I have created a site in office 365 environment and added some third party customized features like twitter and tried to save the site as template by navigating to Site settings. Bu I am unable to find “Save site as template” option in site settings page.

While troubleshooting the issue I have checked few posts in msdn and tech net forum. By checking all the posts I have found that SharePoint doesn't allow to save the third party apps. By removing the third party apps, i am able to save the site as template. But I need the third party app should be include in my sub site.

By checking few more posts I got a trick for this. To enable save site as a template in site settings page, we have to set “SaveSiteAsATemplateEnabled” parameter in office 365 site. To do that, open the site in SharePoint designer in homepage, click on “Site Options” link.

We can get a pop up box with four tabs. In Parameters tab, find for “SaveSiteAsATemplateEnabled” and update the value from false to true.


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.



Monday, August 11, 2014

SharePoint 2013 workflow compiling error: Workflow XAML failed validation

While working with SharePoint workflow, I got compilation error in Start a task process activity. By clicking the error (clicking on the top “check errors button”) I don’t see any issues. When publishing the workflow I got the error saying that “Microsoft.Workflow.Client.ActivityValidationException: Workflow XAML failed validation: Cannot set unknown member CompositeTask.RelatedContentLinkListItemIntegerId’. HTTP headers received from the server”


Iam unable to publish the WF in SharePoint designer with my credentials and My friends credentials. To fix the issue, I have checked in to issue and found the fix in following blog and MSDN

To fix the issue, we have to register workflow service using following command

Register-SPWorkflowService -SPSite 'MySiteURL’ –WorkflowHostUri ‘Site URL' -AllowOAuthHttp –Force


Hope this helps.

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()


Wednesday, July 16, 2014

SSRS report – SharePoint list error: an error occurred when accessing the specified SharePoint list. The connection string might not be valid

While creating the report by using SharePoint list, I got an error saying that “an error occurred when accessing the specified SharePoint list. The connection string might not be valid” as shown the image below.



I have checked all the possibilities for the error by changing the credentials in the report. It didn’t worked for me. Changed the connection string URL. Restarted BI development studio and Restarted Reporting services and finally restarted the machine too... No luck. L
By checking more than half day I have found the cause. The reason is, I have changed my VPN password recently and disabled UAC in my machine. So by connection the site, it is using my old password stored in windows vault.

We have to change the stored credentials in windows vault by using the steps below,
Navigate to Windows vault and in Windows credentials section select the site and update the credentials.




Now Iam able to access the list from SharePoint list  

Saturday, July 5, 2014

PowerShell Commands: Download files/documents from SharePoint document libraries

In SharePoint 2013 we have an option to sync all the data from SharePoint document libraries to local folders by using Shared drive concept. We can download the document s from SharePoint document library using Power Shell commands also. We can do that in overall site collections and all the site collection may contain loads of documents and downloading one by one is a huge task by using windows explorer.

To download the document we can use following script,

$listUrls="Doc lib 1 URL″,” Doc lib 2 URL ″,” Doc lib 3 URL ″," Doc lib 4 URL ″ (All the document libraries URL’s)
#Enter the web site URL

$web = Get-SPWeb -Identity $webUrl

#Load all the list URLs in the web, Open the list URL.

foreach($listUrl in $listUrls)
{

#get the list URL

$list = $web.GetList($webUrl+”/”+$listUrl)

function DownloadDocuments{
    param($folderUrl)
    $folder = $web.GetFolder($folderUrl)
    foreach ($file in $folder.Files) {

       
#Ensure destination directory

        $destinationfolder = $destination + “/” + $folder.Url
        if (!(Test-Path -path $destinationfolder))
        {
            $dest = New-Item $destinationfolder -type directory
        }

       
#Download file

        $binary = $file.OpenBinary()
        $stream = New-Object System.IO.FileStream($destinationfolder + “/” + $file.Name)
        $writer = New-Object System.IO.BinaryWriter($stream)
        $writer.write($binary)
        $writer.Close()
        }
}

#Download root folder documents

DownloadDocuments ($list.RootFolder.Url)
foreach ($folder in $list.Folders) {

#download all the documents in each sub folders

   DownloadDocuments($folder.Url)
}


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. 

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.

Wednesday, June 4, 2014

SPGrid Error in SharePoint 2010: System.ArgumentNullException: Value cannot be null. Parameter name: container

While working with SharePoint 2010 Grid view grouping depending on dropdown value, got an error saying that “Value cannot be null. Parameter name: Container” as shown the image below.
















Iam unable to find the issue while debugging the code. I have spent much time on this issue finally got the reason. By making “EnableViewState” to false error got fixed as show the code below.

grdPropertyValues.EnableViewState = false;
grdPropertyValues.AllowSorting = true;
grdPropertyValues.AllowGrouping = true;
grdPropertyValues.AllowGroupCollapse = true;



Here grdPropertyValues is SPGridview object. 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.

Saturday, April 26, 2014

SharePoint 2013 feature deployment error: Failed to get the list schema XML for feature in GetUserListSchema()

While deploying SharePoint solution I got an error saying that

Error occurred in deployment step ‘Activate features’: Cannot complete this action. By checking the error in logs I have found the exception details as

GetUserListSchema(): Failed to get the list schema XML for feature

By digging into the issue I have found that there is some scope activation details we are unable to deploy this feature. In the code I have added a list definition and list template associated to that list definition. I have added a new feature scoped with site and moved List definition feature to that. So here I have changed the List definition scope from web to Site and kept list template on the same scope. While deploying the feature I got the error on that.

To fix this issue we have to edit the list instance elements.xml file and need to update the list definition feature id in elements.xml file.  
We can update the list inastance elements.xml as

  <ListInstance Title="Name of the list instance"
                TemplateType="10000"
                FeatureId="List definition Feature ID"
                Url="Lists/InstanceName"
                Description="List instance description">
  </ListInstance>



By updating the feature id, Iam able to deploy the solution without issues. Hope this helps.

SharePoint – Back to basics- Creating lists using excel by using Import spread sheet template

We can create SharePoint list using Excel sheet using Import Spreadsheet Template. As a Developer\Administrator we can have knowledge on how to create the lists and libraries. But End users will not aware of this. For this purpose we have an option to create the list by using excel sheet having data.

To create using Excel sheet we have an option “Import Spreadsheet” as shown the image below.



While creating the list, Select “Import Spreadsheet” option. By selecting the option we’ll be navigated to details form page as below. Enter Name and description for new list and browse the Excel sheet in File location. Click on Import Button to update the data to select the data from the list.



Once user importing the data, list will be created with all the existing columns in sheet. Sometime SharePoint will not identify the type column. That’s only disadvantage with this option
Hope this helps.


Saturday, April 19, 2014

Send meeting request in SharePoint custom workflow

Working with SharePoint workflow I got a requirement to send meeting request by using the code. I have dig into deep to check if there is any option to send meeting requests by using SharePoint workflow but I couldn’t find anything. So we have only option to send meeting request through C# code.
My friend Ravi helped me on the code finally by using the code below we are able to send the meeting requests.

private void SendMeetingRequestMail(VacationRequestMail reqMail, string smtpTO, string smtpServer, string smtpFrom)
        {
            using (MailMessage mailMessage = new MailMessage(smtpFrom, smtpTO))
            {
                mailMessage.Subject = “Subject”;
                mailMessage.Body = “Body”;


                DateTime startDate = “Start Date and Time
                DateTime endDate = “End Date and Time

                StringBuilder str = new StringBuilder();
                str.AppendLine("BEGIN:VCALENDAR");
                str.AppendLine("PRODID:-//Vacation Request Portal");
                str.AppendLine("VERSION:2.0");
                str.AppendLine("METHOD:REQUEST");
                str.AppendLine("BEGIN:VEVENT");
                str.AppendLine(string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", startDate));
                str.AppendLine(string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", endDate));
                str.AppendLine("LOCATION: Vacation Request Portal, India");
                str.AppendLine(string.Format("X-MICROSOFT-CDO-ALLDAYEVENT:TRUE"));
                str.AppendLine(string.Format("UID:{0}", Guid.NewGuid()));
                str.AppendLine(string.Format("DESCRIPTION:{0}", mailMessage.Body));
                str.AppendLine(string.Format("X-ALT-DESC;FMTTYPE=text/html:{0}", mailMessage.Body));
                str.AppendLine(string.Format("SUMMARY:{0}", mailMessage.Subject));
                str.AppendLine(string.Format("ORGANIZER:MAILTO:{0}", mailMessage.From.Address));
                str.AppendLine("X-MICROSOFT-CDO-BUSYSTATUS:FREE");
                str.AppendLine("BEGIN:VALARM");
                str.AppendLine("TRIGGER:-PT18H");
                str.AppendLine("ACTION:DISPLAY");
                str.AppendLine("DESCRIPTION:Reminder");
                str.AppendLine("END:VALARM");
                str.AppendLine("END:VEVENT");
                str.AppendLine("END:VCALENDAR");
                System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType("text/calendar");
                ct.Parameters.Add("method", "REQUEST");
                AlternateView avCal = AlternateView.CreateAlternateViewFromString(str.ToString(), ct);
                mailMessage.AlternateViews.Add(avCal);

                using (SmtpClient smtpClient = new SmtpClient(smtpServer))
                {
                    smtpClient.Send(mailMessage);
                }
            }
        }

We have multiple options while sending meeting requests. For example “X-MICROSOFT-CDO-BUSYSTATUS:FREE” will set the user state to free even user accept the meeting request. Hope this will help.


SharePoint 2013 Reporting Service Applications – Enable Remote errors for a Reporting services Service Application

We can enable remote errors in for report services installed through SQL Server 2012 in SharePoint or newer versions of reporting services. To enable the service applications we have to set Enable remote error. This will be configured for all the report service applications. To do that we have to follow the steps below,

Navigate to SharePoint central Administration, click on manage service application in Application management section


Select the Service Application in the list of service Applications and Click on the name of Service Application
Click on the System Settings. In Security Section Select "Enable Remote Errors" and click on Ok to Save the Settings.


Friday, April 18, 2014

SharePoint - Back to basics - Display data in groups and sorting in SharePoint data grid view

We can use data view web parts to display data for adding different feature to show our list data. We can display groups and sorting by using data grid view web part. By using grouping sorting options in grid view we can display the item group wise

To add Data View web part to SharePoint page open SharePoint page in designer and in insert tab click on Data View Web part. Add Empty data view web part to the page.



Select the list to add the data view web part by clicking on “Click here to select data source” link in the web part.



We can see the pop up with all the lists in the site. Select the list.


In the right side pane, select multiple view to see all the items in the web part.


We can add/remove the columns to the web part by click on “Add or Remove columns” in the top ribbon. We can sort and group the data by clicking the “Sort and Group” option in top ribbon.



By clicking on the “Sort and Group” option we can see a pop up to add sorting and grouping columns.  We can have the options to collapse and expand the grouping in “Group Properties” section. Also we can edit the sort expression to display the items.



By checking “Sort & Filters on headers” we can provide sorting and filtering options as regular list columns. We can add Grouping tool bar for data view web part by selecting the options tab as shown in the image below.




After all we can see the data with grouping and sorting.