Thursday, November 27, 2014

Upload files into Document Library in SharePoint Online Using Powershell.

The following PS script could be used for uploading files into Document Library in SharePoint Online.

The following PS script could be used for uploading files into Document Library in SharePoint Online.
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"


Function Ensure-Folder()
{ Param(
[Parameter(Mandatory=$True)]
[Microsoft.SharePoint.Client.Web]$Web,
[Parameter(Mandatory=$True)]
[Microsoft.SharePoint.Client.Folder]$ParentFolder,
[Parameter(Mandatory=$True)]
[String]$FolderUrl

)
$folderUrls = $FolderUrl.Trim().Split("/",[System.StringSplitOptions]::RemoveEmptyEntries)
$folderUrl = $folderUrls[0]
$curFolder = $ParentFolder.Folders.Add($folderUrl)
$Web.Context.Load($curFolder)
$web.Context.ExecuteQuery()
if ($folderUrls.Length -gt 1)
{
$curFolderUrl = [System.String]::Join("/", $folderUrls, 1, $folderUrls.Length - 1)
Ensure-Folder -Web $Web -ParentFolder $curFolder -FolderUrl $curFolderUrl
}
}

Function Upload-File()
{
Param(
[Parameter(Mandatory=$True)]
[Microsoft.SharePoint.Client.Web]$Web,
[Parameter(Mandatory=$True)]
[String]$FolderRelativeUrl,
[Parameter(Mandatory=$True)]
[System.IO.FileInfo]$LocalFile

) try {
$fileUrl = $FolderRelativeUrl + "/" + $LocalFile.Name
[Microsoft.SharePoint.Client.File]::SaveBinaryDirect($Web.Context, $fileUrl, $LocalFile.OpenRead(), $true)
}
finally {
#$fileStream.Close()
}
}
function Upload-Files()
{
Param(
[Parameter(Mandatory=$True)]
[String]$Url,
[Parameter(Mandatory=$True)]
[String]$UserName,
[Parameter(Mandatory=$False)]
[String]$Password,
[Parameter(Mandatory=$True)]
[String]$TargetListTitle,
[Parameter(Mandatory=$True)]
[String]$SourceFolderPath

)
if($Password) {
$SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force
} else {
$SecurePassword = Read-Host -Prompt "Enter the password" -AsSecureString
}
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($Url)
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,$SecurePassword)
$Context.Credentials = $Credentials
$web = $Context.Web
$Context.Load($web)
$list = $web.Lists.GetByTitle($TargetListTitle);
$Context.Load($list.RootFolder)
$Context.ExecuteQuery()
Get-ChildItem $SourceFolderPath -Recurse | % {
if ($_.PSIsContainer -eq $True) {
$folderUrl = $_.FullName.Replace($SourceFolderPath,"").Replace("\","/")
if($folderUrl) {
Ensure-Folder -Web $web -ParentFolder $list.RootFolder -FolderUrl $folderUrl
}
} else{
$folderRelativeUrl = $list.RootFolder.ServerRelativeUrl + $_.DirectoryName.Replace($SourceFolderPath,"").Replace("\","/")
Upload-File -Web $web -FolderRelativeUrl $folderRelativeUrl -LocalFile $_
}
}
}


#Usage

$Url = "https://contoso.sharepoint.com"
$UserName = "username@contoso.onmicrosoft.com"
$Password = "password"
$TargetListTitle = "Documents" #Target Library
$SourceFolderPath = "C:\Users\user\Upload" #Source Physical Path

#Upload files
Upload-Files -Url $Url -UserName $UserName -Password $Password -TargetListTitle $TargetListTitle -SourceFolderPath $SourceFolderPath

Why Use SharePoint?


Businesses are understandably resistant to new tools when things already seem to be
going well, and may become even more conservative when things take a turn for the worse.

That’s one reason why businesses who have heard of SharePoint may decide against implementing it.
We feel that’s a mistake for most businesses, and we like what our partner P2 Automation recently said about why businesses need Sharepoint.

Have you ever found yourself sending the same email attachment over and over
again? Have you dug through your emails laboriously, trying to pick up a
conversation where you left off? What about tracking changes you made to
documents? Did you have to remind your employees to enable tracked changes,
or ask them to highlight the changes themselves?

These are the kinds of problems that SharePoint is designed to minimize. It’s meant to
transform intranet communications into a seamless and comprehensive
experience. It automates all the redundancy out of your business’s workflow, so
that you can focus on your core business operations. In other words, it’s a way
to transform technology from a distraction into a catalyst.

SharePoint’s core functions are to:
1. Collaborate – Easily create teams that communicate effectively
2. Organize – Simplify the process of finding information in documents and
conversations
3. Share – Make sure everybody who needs to be up to date on something easily is
4. Manage – Easily track and manage projects simultaneously

Finally, one of the primary benefits of SharePoint over the alternatives is the fact that
it’s powered by Microsoft, so it works together seamlessly with Office and Outlook.

Thursday, November 20, 2014

User Profile Application Proxy failed to retrieve partitions from User Profile Application


This issue happens mostly on the Farm installation. Everyone will say to recreate the UPS, restart the server and then it should work fine. But if you have used the Custom properties and created a managed property in Search then its very difficult to recreate it and then to create it again. The better solution so far i have researched is the following Stop the User Profile Synchronization service Stop the User Profile Service Start the User Profile Service Start the User Profile Synchronization service. I hope the above should help you resolve the issues. Cheers.

Tuesday, November 18, 2014

How to use Best Bets SharePoint 2010 Search


In this blog, I will set up a Best Bet and keyword in SharePoint 2010.
Best Bets are a great way for Site Collection Administrators to
help guide users to the content they are looking for as well as
promoting some content to users on an as-needed basis.


In this blog I have created an out-of-the-box Site Collection using a
Team Site as the top level site template. I have created a sub-site
and used the Basic Search Center as the template and named it Search.

Here are the steps I'll do:
1. Hook up the Search Center
2. Test a search. (I'll use the term "Black Flag").
3. Configure a Keyword and best bet.
4. Test the results.
(Note this will not work with SharePoint Foundation out-of-the-box,
you must have Standard or Enterprise. Also, I don't have Fast Search setup in this environment, if I did, I would use Fast Search Keyword and
Best Bet, the idea is the same but the UI is a little different).

A Quick Environment Overview


I'm on the top level site where I can observe a top link navigation bar to my Search Center.

Hook up the Search Center
In order to use the keywords and best bets on a team site, I need to hook

up the settings on the site collection. The best bets and keyword is a web part and as a result, it needs a page with the web part on

it to show. The Basic Search Center results page is a web part page with this web part already on it so it's a great choice. In order to

hook it all up I go to Site Actions > Site Settings from the top level site of the site collection.


In the Site Collection Administration links section of the Site Settings page I click on Search Settings.

Enable Custom Scopes



I want to click the radio button to enable custom scopes and provide the http address to my Search
Center. I also change the Site Collection Search Dropdown mode in order to
show Scopes while I'm here. I leave the rest as is and click OK.




Now I'll go to the search center by clicking the Search link in the top link navigation bar.
Test the Term


>
I notice that there are a couple of results, but I want to have a
result at the top which will point to Interface Technical Training so I'll set that up using a Keyword and Best Bet.


Back to Top Level Site Actions – Site Settings

I return to the home page of the top level site (not shown) and click Site Actions> Site Settings

Set up Keywords

I click on the link Search Keywords in the Site Collection Administration section of the Site Settings page.

Add Keyword

I click the Add Keyword link on the Manage Keywords page.

Add Keyword and Synonyms Click Add Best Bet

I type in the term I'm targeting (Black Flag). In the Synonyms,
I add some terms that I would also like to target because it's possible people will type these in
as well. I then click the link to Add Best Bet.

Fill out Best Bet Form

Next, I fill out the Best Bet form adding a link to Interface Technical Training as well as a Title (or tag line) and a Description, and click OK.

Add Other Information as needed. Then click OK


I'm going to leave the rest of the settings at their default and click OK.

Go to Search Center to test



When I'm done, I can see the new Keyword and Best Bet added and I click on the Search link
in the top link navigation bar to return to my Search center for testing.

Enter Keyword and Search

Once again I enter Black Flag and hit the search icon.
Validate Results


VoilĂ , my Keyword and Best Bbet are at the top of the Search Results.
There is no waiting for any timer jobs, the effect is immediate!
That's it.
I successfully set up a keyword and best bet in SharePoint 2010!

Thursday, November 13, 2014

Integrated and Native Mode SSRS Performance Comparison


SSRS Performance in Native and Integration Mode

o begin with, let me briefly touch on process in both. SSRS in Native Mode:





Steps:
End user requests a report to a Reporting Service Engine.
Reporting Service Engine retrieves report definition from the Report Server Catalogue.
Reporting Service Engine sends query requests to the database(s).
Reporting Service Engine sends the extracted report to the end user.
End user sends request to Reporting Service Engine to format output (Excel, PDF etc..).
Reporting Service Engine returns the report in the end user’s requested format.





Steps:

End user requests a report to SharePoint Web Services.

SharePoint Web Services retrieves the report definition from the SharePoint Catalogue.
SharePoint Web Services requests a report from the Reporting Service Engine.

Reporting Service Engine queries Report Server Catalogue to compare and authenticate report definition with the report definition received from the
SharePoint Catalogue.
Reporting Service Engine sends query requests to the database(s).
Reporting Service Engine sends the extracted report to the SharePoint Web Services.
SharePoint Web Services sends the extracted report to the end user.
End user sends request to SharePoint Web Services to format output (Excel, PDF etc…).
SharePoint Web Services requests Reporting Service Engine to send report in the end user’s requested format.
Reporting Service Engine returns the report in the end user’s requested format to SharePoint Web Services.
SharePoint Web Services returns the report in the end user’s requested format to the end user.
We see that communication in SSRS in Integration Mode takes more steps than in SSRS in Native Mode and this is reflected in performance. However, the
difference is microseconds.

The choice between Native and Integration mode really depends on the organization as
performance isn’t much of an issue. If they prefer the SSRS in
Integration Mode with improved performance, they can add more computing resources to the infrastructure.

Monday, November 10, 2014

"The workbook cannot be opened".Excel Services & PowerPovot for SharePoint Troubleshooting




When opening an Excel workbook (.xlsx) in the browser the error "The workbook cannot be opened" is thrown:

This is caused by the account running Excel Services not having proper permissions to the Content Database.
When you upload an Excel workbook to a SharePoint library, the workbook is stored as blobs in the Content Database. When you choose to open this in
Excel Services, the account running Excel Services needs to retrieve and reassemble the workbook. If the account running Excel Services lacks proper
permissions, "The workbook cannot be opened".

We have a KB on how to resolve this issue: The Excel Services Application for SharePoint 2010 does not load or display workbooks http://support.microsoft.com/kb/981293 In this blog, I will step you through this KB; where to collect data and explain what the two below SharePoint Management Shell Commands do: $w = Get-SPWebApplication –Identity $w.GrantAccessToProcessIdentity("") You need to find the . To do this: 1. Browse to the report library where the failing workbook is located and make note of the URL.



2. Central Administration > Application Management > Manage web applications compare the URL to the list of Web Apps. Find the correct Web App URL and add it to “URL of the web application”.



You now have the first command: $w = Get-SPWebApplication –Identity http://tschauer 3. Central Administration > Security > Configure Service Accounts > from the first dropdown, select the application pool running "Excel Services Application" and add that account where is says “”.



You now have the second command:

$w.GrantAccessToProcessIdentity("Devtest\Excel_Services_Account")

So now you can run these commands by following the below steps:

1. Click Start, click All Programs. 2. Click Microsoft SharePoint 2010/2013 Products. 3. Click SharePoint 2010/2013 Management Shell. 4. At the Windows PowerShell command prompt (PS C:\>), type the following command, and then press ENTER:

$w = Get-SPWebApplication –Identity http://tschauer

$w.GrantAccessToProcessIdentity("Devtest\Excel_Services_Account")

When you run these commands you are:

1. Adding the account running Excel Services as a User to the Content Database (Security > Users).

2. Giving the account running Excel Services the SPDataAccess Membership (Account > Membership)

3. Giving the account running Excel Services Full Control to the Web Application (Via "Policy for Web Application")

Google+ Followers