Thursday, December 6, 2012

SharePoint Workflows won't start

A customer wanted me to set up a library for incoming e-mails. He wanted a simple solution to sort the e-mails in different folders. I thought that this would be an easy task, and it proved that I should never underestimate SharePoint 2010 or Nintex. Ever. Again.

I sent a lot of email and all got saved in this document library. I was kinda proud because everything went really well until I realized: The workflow won't start.

Incoming emails will be moved to a library via System Accounts, which won't trigger a workflow. That means you have to enable this little feature with a little command:

stsadm -o setproperty -pn declarativeworkflowautostartonemailenabled -pv true

And that's it. Now incoming emails will trigger workflows.

Sunday, August 19, 2012

SharePoint 2010: Split SiteCollections and ContentDB (Part 2)

So... here's a little script I wrote, maybe this will help you with splitting your SiteCollection & ContentDB. I think if you're using my last blog, you will get the code.
If you do have trouble understanding it or if you're having any questions, please feel free to comment below, I will get back at you.


Tuesday, August 7, 2012

SharePoint 2010: Split SiteCollections and ContentDB

Today, I want to write about a little problem I had. Let's say your ContentDB is getting really huge, like 150GB+,  and you need to split it, but you are only using one SiteCollection. What will you do?

Split your damn SiteCollection!
Of course SharePoint 2010 will work with a 200GB+ ContentDB. Even 4TB are possible, but their no fun when you're trying to back up that stuff. You will need a really great SharePointArchitect to keep that under control. Why would you like to do that? There's no reason. So just split your SiteCollection.

But how?
First step on this maybe-rocky-road: Make up your mind. Think about how big your pages are and how do you want to split your SiteCollection. Maybe your SiteCollection is already logically splitted by a navigation panel or whatever. Usually you have different categories which will create your navigation. Using this is usually a really good start. Check your sites, maybe some of them are already huge, like 25 -50gb or even more. For those pages I would recommend an own ContentDB.

Create new ContentDBs!
Let's assume we now know in which categories we want to split our SiteCollection. Now we need to head over to the Central Administration. Click at "Application Management" and choose "Manage content databases".

Here you can create your new content database. Think about the database name and choose a smart one. You don't want to have hundreds of "WSS_Content_XX" databases.

Create a new SiteCollection!
Again we do this in our Central Administration. And again you will find this option under "Application Management".
Again choose a smart name.

Export your Site. Please.
There are a couple of ways to do this. Of course you can copy all your files by hand. That's one of the ways I don't like. So we just take the easiest way: Export-SPWeb. Just run this command in your PowerShell-Tool.
Export-SPWeb -Identity WEB -Path SAVE -IncludeUserSecurity -IncludeVersions all -NoFileCompression -Force
WEB = This is the identity of the web / site / list / item you want to export
SAVE = This is where you want to save your back up
-IncludeUserSecurity = Include Usergroups and Site Permissions
-IncludeVersions all = Include all Versions of your site, list, or document library
-NoFileCompression = Decide if the back up file is compressed or not. If you choose not to, you will get a folder and of course the size is bigger than the compressed version.

Import me baby!
This can get a bit troubling at times, depending on your farm. If you have some special features activated, you need to do the same on the new target site. Also if you are using a different theme, you have to choose this first. If you have some features, you can script the activation too.
Enable-SPFeature -Identity GUID -Url TARGETSITE
 Now we can import our back up.
Import-SPWeb -Identity TARGETSITE -Path SAVE -Force -NoFileCompression
TARGETSITE = This is the Site, where you want to import your backup
SAVE = This is where you saved your backup

Split your Database!
Maybe you remember that you created a new ContentDB at the beginning. Now it's time to use it. We will move our SiteCollection via PowerShell to it's new home!
Move-SPSite SITE -DestinationDatabase CONTENTDB
 SITE = The site you want to move.
CONTENTDB = your destination database
Make sure that the ContentDB is on the same server!

And that's it! Now you have a couple of SiteCollections instead of one huge and you can move them to different ContentDBs. Not that hard, right?

Well, I had some problems which I will address (including an example-script) in my next post, so stay tuned for more information on export, import, moving and those little funny workflows and templates.

Monday, July 16, 2012

Visual Studio: How to remove a TFS binding?

Today I got my hands on a solution, developed from a customer. They do have their own TFS System, which I am not allowed to connect to. But I always got this message:
But how do I change the connection?
Well, it took me a while, because I don't think that it's placed under "File" correctly. Here you can find the option to change the connection or remove it completely:

Tuesday, July 3, 2012

New SharePoint is called SharePoint 2013

I read the news on this blog: http://blog.furuknap.net/sharepoint-2013-name-confirmed-and-sharepoint-store-details

I think it is important to share those information with everyone else.
Also I'm surprised that it's called "SharePoint 2013", I was waiting for "SharePoint 15" oder maybe "14". Second thing is, that there may be an "Office 2013".
So please read the posted link, which might come in handy.

SharePoint 2010: Juni 2012 CU (#Update 1)

Link to the KB 2598354
You will get all Information on this site.

Issues that this hotfix package fixes


This cumulative update package also fixes the issues that are described in the following KB articles:
  • 2687305
    Description of the SharePoint Server 2010 hotfix package (wdsrv.msp): June 26, 2012
  • 2687303
    Description of the SharePoint Server 2010 hotfix package (ifswfe-x-none.msp, ifsmui-xx-xx.msp): June 26, 2012
  • 2598384
    Description of the SharePoint Server 2010 hotfix package (spsmui-x-none.msp): June 26, 2012
  • 2598380
    Description of the SharePoint Server 2010 hotfix package (ifswfe.msp): June 26, 2012
  • 2598373
    Description of the SharePoint Foundation 2010 cumulative update package (SharePoint Foundation server-package): June 26, 2012
  • 2598349
    Description of the SharePoint Server 2010 hotfix package (Coreserver.msp): June 26, 2012
  • 2598348
    Description of the SharePoint Foundation 2010 hotfix package (Wss-x-none.msp): July 2, 2012


I'm installing the Update in the afternoon, maybe I can post some feedback in the early evening.

*Update #1*
So... I installed the update today and it works pretty good. Finally I can receive incoming emails without using a quote again. I just installed it on my own maschine, I will give a little feedback after I installed it on a live system.

Monday, July 2, 2012

SharePoint 2010: "An error has occurred" (Excel WebApp) [Update]

Today I woke up and thought: "The weather could be worse." And it got worse.
Then I thought: "At least the servers are running, so it could be worse on a Monday morning." And it got worse. The Excel WebApps weren't working. With the best error message ever, thanks to Microsoft for clearing up the problem that might occured:
An error has occurred.
Please try again.


Actually. It's not okay. It's one of those error message that could mean anything. Maybe a planet in outer space just exploded and forced Excel WebApps to stop working.

So, my first idea was: Maybe the service is missing some rights or something. So I used a little PowerShell script, but that didn't help. I'm posting it so it may help you.
$web = Get-SPWebApplication http://applicationurl/
$web.GrantAccessToProcessIdentity("DomainName\ServiceAccount")
So I tried to search for this error, but nothing helped. I checked the App Settings, check if any error occurred.

In the end one simple thing did the trick: Restarting the service fixed the problem.

But why did this help?
Well, we deleted files from the TEMP directory... and there are all those Excel WebApp Temp files, which are needed to display. These files will get initialized when you restart the service. Problem solved.

*Update 7/16/12*
In my case I restarted the Excel Web Services.

Thanks to Taras Kun for his tip:
"I got it fixed simply by restarting Microsoft SharePoint Foundation Web Application service In Central Administration > Application Management > Services on Server."

Monday, June 18, 2012

SharePoint 2010: April 2012 CU (Update)

So a new CU came out a couple of weeks ago. I've been installing the April 2012 CU in Mid-May on one of my test servers. Since then I noticed some bugs and searched the web for other problems.
Well, the list is not that long, but long enough to mention. It prevented me to update our server used by our customers. Here are some good articles about the original CU version:
- SharePoint April 2012 CU: This hotfix package is no longer available due to a technical problem
- April 2012 CU causing problems with incoming e-mails in SharePoint 2010
- http://msmvps.com/blogs/ivansanders/archive/2012/06/17/update-april-2012-sharepoint-cu-re-release-april-24-2012.aspx

An here is the new version: http://support.microsoft.com/kb/2598151
Including the changes:
UpdateA recent, isolated issue was discovered in the SharePoint 2010 Products April 2012 Cumulative Update that could result in an HTTP 500 error when users delete objects to include documents, lists, and Webs and a new  object is created using the same path where the original object remains in the Recycle Bin. The following packages were affected:

KB2598151 - SharePoint Server Package
KB2598152 - Project Server Package
KB2598321 - SharePoint Foundation Package
KB2598304 – Wss-x-none.msp

Resolution
This issue has been resolved in the revised packages. The revised packages include support for resolving issues related to the originally published updates.

Products Affected
SharePoint Foundation 2010
SharePoint Server 2010
So... Does this fix my problems? Well, stay tuned. I'm installing right now.

*edit 6/19/2012*
I found another really interessting post about the April 2012 CU: April 2012 Cumulative Update – All Changes

But back to my problem: I wasn't able to send emails to a list, in my case a document library. After installing the new CU, I still wasn't able to do so. I had to implement that fix, posted above, again. Which is, in my opinion, a really bad solution.
I'm still hoping for an update that will fix that problem. Do you hear me Microsoft?

Monday, June 11, 2012

SharePoint 2010 Tags & Tag Cloud for Blogs

I wanted to have a nice little Tag Cloud for a blog which is used within the company I'm working for. I searched a bit on how to make this happen. To be honest I thought it would be easy, like here on blogger.com or some similiar systems. Oh my gosh have I  been wrong.

My first wild guess was to use a Term Store, but that didn't work out, since I wasn't able so far to use it on every site on this blog. If someone knows how this could work, please post a reply to this post.

What now? I want that Tag Cloud and I want it know!

Let's approch this in a different style using a new feature in SharePoint 2010. Well, new for me. Open a blog post and take a look at your ribbon, you'll find a nice little button there:
Click on "Tags & Notes", a new window will pop up:

Enter your tags, they will be displayed in this little box and you will get a notification below and also on your MySite if activated.

But how can other people see these tags on the blog? 
We just use a little webpart called "Tag Cloud". Go back to your blog und edit the page, search for this web part:

Add this to your site and edit the properties. Choose to display all user tags:

This may take a couple of minutes until they get displayed, so don't worry like I did. And that's how you get your little own Tag Cloud.

Monday, April 23, 2012

SharePoint: Set Alerts on tasks list

After my shot with that script back fired a couple of days ago I needed a solution that worked. I remembered that there was a function that might work. I only tried this for the tasks list.

Open your tasks list, click on "List Settings", head over to the "Adcanced settings". You will find "E-Mail Notification" there.
When you click on "Yes", the assigned user will get an Email if something changes in his task, except if it's the description field. And of course he get's an email that a task was assigned to him.

Sunday, April 22, 2012

PowerShell: Update every list item in SharePoint

So I do have a workflow that starts, when an item has been changed. And i got a list with many items, which need an update to get the workflow started. Instead of clicking on every item, I decided to write a little script, to create an update on every item.
$web=get-SPWeb "YOURWEB"
$list=$web.Lists["YOURLIST"]
$list.title
foreach($item in $list.Items)
{
    $item.update()
}
$web.dispose()
And now the workflow will run for every item.

Wednesday, April 18, 2012

PowerShell: Set SharePoint Alerts

I had to come up with a way to set user alerts without sending a notification. I completely forgot about a little function SharePoint provides, which I will post about tomorrow.
My first idea was to just use PowerShell. In the end I came up with two scripts, unfortunately the second one just won't work. But I will post it anyway, maybe it helps someone to get an idea on how to work on the subject.

The first script will get you the user who got the task assigned to. I will only take a look at the last one modified, because my workflow runs everytime an item is created or changed.

## Get user who is assigned to task
$TaskList = $web.lists["Tasks"]
$item = @($TaskList.items | Sort-Object {$_.Modified} -Descending)[0]
$users = $item["Assigned To"].split("#")
$var1 = $users[1]
$var2 = $item
The second one is the one I can't get to work. Maybe someone can sort it out and work with it. I checking the list "Tasks", where I publish all tasks and assign them. Then I want to add an alert, called "Custom Alert", but only on the last modified item.


##########################################
## Create an alert without notification ##
##########################################
$web = Get-SPWeb("YOURWEB)
$TaskList = $web.lists["Tasks"]$alerts = $web.Alerts
$user = $var1
$item = $var2
###################
## Set new alert ##
###################
$setAlert = $web.Alerts.Add()
$setAlert.Title = "Custom Alert"
$setAlert.AlertType = [Microsoft.SharePoint.SPAlertType]::Item
$setAlert.Item = @($TaskList.items | Sort-Object {$_.Modified} -Descending)[0]$setAlert.DeliveryChannels = [Microsoft.SharePoint.SPAlertDeliveryChannels]::Email
$setAlert.EventType = [Microsoft.SharePoint.SPEventType]::Add
$setAlert.AlertFrequency = [Microsoft.SharePoint.SPAlertFrequency]::Immediate
$setAlert.Update()
Maybe you are wondering why I'm using names such as "$var1". Well, this is because of a tool called "Nintex Workflow". They provide the function to store values through your workflow, but the names are "$varX".

SharePoint: Where did my files go?

Today a user called me asked where his file went and why SharePoint is telling him, that he can't upload it again. The error message containt a message, saying that the file is already checkout to a user.

I checked the library in SharePoint and via Windows Explorer, but the file was indeed gone. So after a while I remembered that there is another way.

Open the library settings and under the topic "Permissions and Management" choose "Manage files which have no checked in version".

And there was the file. I took over ownership and checked the file in.

Monday, April 16, 2012

SharePoint (Slide Library): Let's make this picture big!

Well, a couple of months back, I had a little run-in with Slide Libraries. A customer asked me if it's possible to resize the thumbnails or make them pop out a bit. Yes, it's possible with a little Javascript.

Here's the script and sorry for the formatting:
<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(getImages, "sp.js");
function getImages()
{
   $("body").append("<div style='display:none; position:absolute;' id='boxdiv'><img src=''
      id='boximg' onMouseOut='hideImageBox()' /></div>");
    var thumbimg = document.getElementsByTagName('img');
    var i = 0;
    for(i=0; i < thumbimg.length; i++)
   {
      if(thumbimg[i].alt == 'Thumbnail')
      {
   thumbimg[i].setAttribute('onMouseOver', 'showImageBox(this.src)');
  }
 }
}
function showImageBox(imgurl)
{
   var IE = document.all?true:false
   var tempX = 0;
   var tempY = 0;

   if (IE)
   { // grab the x-y pos.s if browser is IE
      tempX = event.clientX + document.getElementById("s4-workspace").scrollLeft;
      tempY = event.clientY + document.getElementById("s4-workspace").scrollTop;
   }
   else
   {  // grab the x-y pos.s if browser is NS
      tempX = e.pageX;
      tempY = e.pageY;
   } 
  
   var boxd = document.getElementById('boxdiv');
   var boxi = document.getElementById('boximg');
   boxi.src = imgurl;
   boxd.style.display = "block";
   boxd.style.top = tempY;
   boxd.style.left = tempX;
  }
function hideImageBox()
{
   var boxd = document.getElementById('boxdiv');
   boxd.style.display = "none";
}
</script>
(Don't forget to add the locations of your JQuery-Sources.)
What does it do? It grabs for the tag "Thumbnail", because that's the "alt"-text of those images. Than we set a new attribute, in this case it's a "MouseOver"-effect. And this will create us the PopUp.

But how do you place this script in your library?
First edit the Page.
That add a new "Content Editor"-Webpart.
That's it. Now you should see little images of your thumbnails flying at you.

PowerShell: Split strings

Oh that's an easy one, but I always forget it after a couple of weeks. Well, I don't use it that often, but it is kind of useful. So let's split all the strings!

$URL = "http://YOURURL.TLD/site/topic
$strings = $URL.split("/")
That's how you split your strings. Now you have a couple of strings, because we split them at the "/". It may not be the smartest idea, but this way you start building the needed address the way we want it.

The result will look something like this:
$strings[0] -> http:
$strings[1] -> ~empty~
$strings[2] -> YOURURL.TLD
$strings[3] -> site
$strings[4] -> topic
But why should anybody do it that way? For example your are working with SharePoint and using the Get-SPWeb command in PowerShell, you will get the address of your web, but that may be not the address you need for a picture or a link. So now you can just edit the link you need.

In my case, I needed to do that to change the "http" to "https". I wrote a blogpost about exchanging strings, which worked fine when I had to change only links. But it wouldn't work with the pictures I implemented, which also needed an https address. And with the .split()-method I was able to recreate the address in the way I wanted it to be.

Thursday, April 12, 2012

SharePoint: Can't publish to Slide Library

I created a Slide Library for a customer, which he really liked. He was playing around on my Dev-System and also on my Test-System. Everything went better than expected so we decided to jump over and release his library for his colleagues. But unfortunatly it didn't go that well on the production system. He was working a couple of days with it and got always problems with uploading some presentation.

When I was back in the office I had to take a look into it, so I started testing with the Dev-System and of course our Test-System. But to my dissappointment it worked fine, so the problem was only somewhere in the production system.

Next thing I checked was the event log, but also nothing unusual. Some typical errors, but nothing new or in any way related to my slide library. Than I read through the SharePoint Logs while uploading a file, just in case it throws an exception or an error of any kind. But also nothing there.

So what else could it be? I took a look at the last installed patches on the systems, but also: nothing related to PowerPoint or the slide libraries.

Finally I gave up and took a look at the PPTX-files I got. Everything looked fine, but when I was running the "Inspect Document" command under "File / Info / Check for Issues" it throws an error, telling me something about "Picture crop information". It was indeed possible, that this information brought up an random error while uploading this file. I clicked the "Remove All" button, but no matter how often I clicked that button and saved the file, it always came up with the same error.

My last attempt was to save the PPTX-file a little bit old school. I decided to save the file als PPT and check out if the error still pops up while uploading. To my surprise it worked fine and I got no error, but I'm still not sure why it came up. I will keep investigating, maybe I will find a proper solution, but for now saving in PPT makes the most sense.

PowerShell: Update a Field in SharePoint

I needed to update a couple of rows from a specific list in SharePoint. The value was luckily always the same. So I wrote this little script:
cls
Add-PSSnapin Microsoft.SharePoint.Powershell
$web=get-SPWeb "YourWeb"
$web.title
$list=$web.Lists["YourList"]
$list.title
foreach($item in $list.Items)
{
   $item["YourField"] = "YourUpdate"
   $item.update()
}
$web.dispose()
I simply pick the web in which I want to work, search for my list there. In this list, I will pick my field and give it a new updated value. Don't forget to use $item.update() at the end, because otherwise your new value won't get displayed.

SharePoint: Which version or update is installed?

If you ever need a way to get the binary information of the installed SharePoint Server, you can go to the Central Administration.

Click on "Upgrade and Migration":

After that, choose "Check product and patch installation status":

On the next page you can see every binary version of the installed products on your farm or on a specific server.

Wednesday, April 11, 2012

PowerShell: Compare Dates

Today we want to compare an existing date from a SharePoint List called "Compare" with the date of today. We want to check if the date is the same or not.

So here is the code:
cls
$web = Get-SPWeb "YourSite"
$CompareList = $web.lists["Compare"]
$CompareListItem = @($CompareList.items | sort-object {$_["Modified"]} -descending)[0]
[datetime]$Today = [datetime]::Now
[datetime]$StartTime = [datetime]$CompareListItem["Start_Time"]
if($Today.Date.CompareTo($StartTime.Date) -eq 0 )
{
   $result = Yes
}
else
{
   $result = No
}
$web.dispose()
What does it do?

It loads your web, than chooses a list, in this case "Compare". I decided that I only need the newest item. With "[datetime]$Today = [datetime]::Now" we will get the date of today. The next line will get us the Date-Field from the SharePoint List. Because we are using "[datetime]", we can now compare the two dates.

PowerShell: Replace (String)

Here's a simple thing in PowerShell and I guess most people already know how to replace strings. I had to come up with an idea on how to replace a piece of information in a domain address.

Here's the little script:

cls
$web = Get-SPWeb "YourWeb"
$httpURL = $web.Url
$httpsURL = $httpURL | foreach{$_ -replace "http", "https"}
$httpsURL

I simply take the "SPWeb" and search for "http". Everytime I get a "http" I will replace it with a "https". It's that simple.

InfoPath 2010: "Full Trust" A Form

This is an easy one, but it took me a while to find this need little feature again.
In InfoPath 2010 you will find every Form Option under "File".

So go to "File", then "Form Option", click on "Security Level" und clear the checkbox next to "Automatically determine security level" and instead select "Full Trust".

Tuesday, April 10, 2012

SharePoint 2010: Create a Slide Library

Slide Libraries are really cool to use, because you can distribute slides for your company or collegues without needing to save every slide in a single .PPT oder .PPTX file. It's also an OOB-Feature in SharePoint 2010. So let's get started on this one!

This is your typical frontpage. I created an empty SiteCollection just to show you how it could and should work.
First click on "Site Actions" and choose "More Options...".
Here you have to do a bit of scrolling and choose the "Slide Library".


Now you just have to click on that symbol and then on "Create". Finally give it a nice little name and a description and your set to go.

So, that was easy right? In the next couple of days we will take a look at what could wrong. And what did go wrong while i used it.