SharePoint Server 2013 – Repair Install Error Message in Russian

Here is an interesting issue that I ran into recently. It took me a while realize what was going on so I figured I would share so others may benefit. I had a client where the SharePoint search died in dev. In the process of trying to get this back up someone had mentioned to just do a repair on the SharePoint install from Control Panel/Programs and Features. So I tried this and I got a really fun error message. Included above. Now it looks to me like this error message was in Russian. So I am asking myself, why is my environment giving me error messages in Russian. So I ran a psconfig and that completed just fine so I ran the repair again and got the same error message.

This morning I showed this to a coworker who speaks Russian and he confirmed that it was indeed Russian. Then the light came on, I can use Bing Translator on my phone to get the real error message. After doing this the resolution was simple. Here is the output of the translation from my phone.
SharePoint Error Russian Translation
Well this error message makes a lot more sense. So I went and downloaded the SharePoint 2013 Install with SP1 and when I ran the install it gave me the same options as the change from the programs and features. I selected repair and it started working. Interestingly the error message says to check the setup.chm file. So I went that as part of my searching. Well that file didn’t exist. So it is not helpful. The folder is there until you click close, then it goes away as well.

So if you see this error message in Russian with the number 1706. Go get the install files and try again.

Thank you Bing Translator!!

Best of Luck.

So Long Public Sites

  Office 365 Public Sites are one of those features that I have mixed feelings about. It was an awesome selling point with client to be able to say, “Buy Office 365 and you get your public site for free.” At ITG we have several clients where we have setup their public site and for the most part it works, as long as you are not expecting full SharePoint functionality. At ITG we have had several discussions about what the best approach would be for our customers that a full ECM solution for their public site since the Office 365 public site didn’t give them that. Well we don’t have to make that discussion anymore, thank you Microsoft.

Continue reading “So Long Public Sites”

What is the WSS_Logging Database?

 

What is the WSS_Logging database?

I was recently at the SharePoint Saturday in Bend and one of the people that attended my session asked a question afterwards that I answered, but I don’t think I gave the response enough justice. The question I was asked was “What is the WSS_Logging database?” After talking with him the underlying problem presented itself. He was having problems because his WSS_Logging was getting rather large. So I explained to him what I thought the database was used for. In general terms it is used for gathering ULS data for the farm. Which if you think about it, this of itself is pretty cool. If you have a 10 server farm you have one location to check for any errors. But this database does so much more. Not only does it aggregate the ULS data it also contains the server event log information as well. The health analyzer tool in Central Admin also uses this database to warn you of problems. In SharePoint 2010 the default name for this database is WSS_Logging in SharePoint 2013 the default is SharePoint_Logging. Other than that the database and information is pretty much identical. In SharePoint 2013 a lot of the usage reports are now part of the Search Databases however.

 

How does this database get its data?

This database gets its data from SharePoint Timer Jobs that run on all the servers in the farm. The data for each type of item is “Partitioned” into tables for the day in question. These partition tables are generated based of the log providers that have been setup. You can control what data gets into this database and on what schedule it gets added from Central Admin -> Monitoring – Configure Usage and Health Data Collection. From here collection can be turned on and off and you can control what items are pulled into the tables.

HealthCollectionTypes

As you can see there are plenty of options that you can select and they are all selected by default. Further down on the screen there is an option that will you to configure the schedule of the data collection. The link is called “Log Collection Schedule”. If you click on this link you will be taken to the two jobs that are used for logging. They are:

  • Microsoft SharePoint Foundation Usage Data Import – Imports the data into the logging database, defaults to running every 30 minutes.
  • Microsoft SharePoint Foundation Usage Data Processing- Handles the processing to move the data into the correct buckets, runs daily.

For each of the events that you select to log you will get tables that correspond. Included below is a snapshot of the tables created for ULS Logging.

WSSLoggingULS

These tables continue through 31. This means you could have data for the last 31 days. The processing job makes sure that daily the events that are tracked are in the correct table for the day.

 

What can I do with this Database?

Microsoft’s TechNet article on this database has an interesting note, “the logging database is the only SharePoint 2013 database for which you can customize reports by directly changing the database.” (http://technet.microsoft.com/en-us/library/jj715694(v=office.15).aspx). Most of the time we are told never touch the SharePoint databases but this is one exception to the rule. Now we are still limited in what we can do with it but at least we won’t get our hands slapped if we look at it. To change the reports we can create SQL views if we want a different view of the report data that is already logged or we can create a custom log provider that will allow us to add new data.

 

Now What?

Now for the million dollar question, how do we control how big this database has become. The simplest option would be to limit the event types that are tracked. This could be done in two ways, by removing the event type all together or going into the Configure Diagnostic Logging screen and changing the logging level. ULS logging can take up a lot of space on the file system and if you multiply this space by the number of servers that are in the farm you can see how this can get out of control really quickly. Limiting what is logged will not immediately fix your database size since the old data will be removed automatically after it is too old.

Another option is to look at which table it is in the database that is taking up the space and you get adjust how long the data is retained in the database. The tables allows us to retain up to 31 days worth of data but the default is 14. To check what you retention level is run the following powershell script: Get-SPUsageDefinition.

If you run this script on a default install that has logging enabled will give you the following output.

UsageRetention

From PowerShell you can change the Retention Period for each individual Event Type by using the Set-SPUsageDefinition commandlet. This commandlet lets us set the retention days and whether an event type is enabled or not. So if we wanted to set the retention period for Timer Jobs to one week instead of two we can run Set-SPUsageDeffinition -Identity “Timer Jobs” -DaysRetained 7. After this is done go to both of the timer jobs mentioned above and run them. This will flush the data that is older than the retention period out of the database. So in this scenario any timer job data older than 7 days will be removed.

SharePoint 2013 Add To Timeline Programmatically

With the release of SharePoint 2013 Microsoft added a couple new web parts that users may have seen but may not have realized that they can use them in their own pages. The two web parts are related and one includes the other. These web parts are the Project Summary Web Part and the Timeline. There have been several blog articles talking about these web parts so I am not going to go into too much detail but the part I will cover is the fact that both these can be used on your own web part pages.

Project Summary Web Part

ProjectSummary

 

The beauty of this web part is its ability to be able to give your users a quick at the status of the tasks within your site. In the top of this web part you can see an option to add a task and edit the list which will both allow you to interact with the list. There is also a scroll arrow which will take you to the a view of the next web part.

Timeline Web Part

TimelineScreenShot

 

The timeline web part is also made available as a user control that you can embed in your own web parts but it is a little tricky to figure out how to make it work, more on how to do that in another post. the Timeline web part is the section in the right portion of the screenshot. What the screen shot does not allow you to see is the fact that you can click and drag the tasks to different places to make it more legible. You can also change the styling and colors of the timeline through the ribbon. Both of these changes are persisted so when you come back later your changes will still be there.

This is cool but can I work with it programmatically?

Both of these web parts are tied to a task list in your site. So to add a task to your timeline it is easy to do from the task list. The menu for the task gives you an option to add to timeline. All this is cool but how do I work with the these web parts? I have searched high and low to figure out how to be able to manipulate the what tasks are shown on the timeline and I couldn’t find anything. So being a developer I decided that if Microsoft can do it in their own web parts then I should be able to do so myself. I found several blogs that mention a programmatic way of adding tasks to a timeline. The task data that is used to generate the timeline is stored as  a property on the root folder on the list called “Timeline_Timeline”. If you look at the value of this property you can see that it is just XML. Easy enough to work with right? This felt like a hack to me so I kept digging.

In my digging I found out that Microsoft added a JavaScript file called sp.ui.timeline.js to the SharePoint page whenever the timeline control is loaded. So I decided to go look at that file and see if I could find a way to add tasks without it being as much of a hack. The sp.ui.timeline.js file is located in the layouts folder under the SharePoint Root. The cool thing is that most of the SharePoint JavaScript files include a debug version that has not been minified. This makes it easier to read, not easy just easier. A lot of the functionality has gone through some sort of obfuscation but you can get some basics.

In digging through the debug file I found that Microsoft exposed a couple methods in the root(window) namespace. These methods are

  • AddItemsToTimeline
  • RemoveItemsFromTimeline

The parameters for both methods are the same. The parameters are included below in order:

  1. items – The items parameter was a tricky one to figure out. I tried a couple variations before I dug some more in the file. It turns out that it expects an array of objects and those objects need to have an id property.
  2. ListID – This is fairly self explanatory except that you need to make sure it is lower case without the curly braces.
  3. ViewName – The ViewName is always the same. The view is “Timeline”

Now with this information it is fairly easy to be able to setup a method to add a remove tasks from the timeline

function AddNewTaskToTimeline(itemID, listId){
    AddItemsToTimeline([{ 'id': itemID }], listId, 'Timeline');
}
function RemoveTaskFromTimeline(itemID, listId) {
    RemoveItemsFromTimeline([{ 'id': itemID }], listId, 'Timeline');
}

These functions could easily be placed as part of your own classes.

So we can add and remove tasks what next?

Now that we can add and remove the tasks on the timeline what is left for us to do? Oh, that’s right this is an enterprise system and we need to provide the user with proper feedback so that we can show them the proper text. Add when they want to add and remove when the task is already on the timeline. This one required some more noodling. I looked all over the JavaScript objects that are created as part of the sp.ui.timeline.js file and I found several places that contain the data that is on the timeline so I thought sweet I can just use those right? Wrong. You can see the items on the timeline but the script from Microsoft does not update these objects when the methods to add and remove are called. The out of the box functionality has the same limitation so I knew it wasn’t that I was adding them wrong. I tried reloading the page after adding but if you reloaded too quickly the add/remove didn’t happen.

After quite a bit of puzzling until my puzzler was sore I came up with an idea. A wonderfully awful idea. I realized that the information I needed was on the server so I thought I could write a service that would get me the data and verify if the task is on the timeline. As I started prepping for this route the SharePoint Developer in me said, “You don’t need to write your own service. Try the out of the box services.” So I did. It turns out that it requires a couple JSOM calls to get to the data I needed but the data is indeed available.

The first step is to load the list from the server. This is a fairly simple JSOM task so that one wasn’t too tricky.

function LoadList() {
    var ctx1 = SP.ClientContext.get_current();
    List = ctx1.get_web().get_lists().getByTitle(ListName);
    ctx1.load(List, "Title");
    ctx1.executeQueryAsync(LoadListCallback, QueryFailed);
}

I snag the list on page load after client context is loaded. I then hold on to this as a variable in my class so that I can use it for the second part.

The list didn’t have the value I needed so I had to go one step further. In looking at the approaches mentioned previously I realized that the data that I wanted is part of the Root Folder of the list. So I had to make another call to SharePoint to get the root folder.

IsTaskOnTimeline: function (taskId, Callout) {
    checkingId = taskId;
    callout = Callout;
    var ctx1 = SP.ClientContext.get_current();
    properties = List.get_rootFolder().get_properties();
    ctx1.load(properties);
    ctx1.executeQueryAsync(CheckTaskCallback, QueryFailed);
}

In my implementation I was  showing the option as part of a callout, another cool piece of functionality that was added in SharePoint 2013. I take the context and the list and go get the root folder  and its properties. Once I have this information in the callback I can now check if the task in question is on the timeline and update the action on the callout accordingly. This method, IstTaskOnTimeline is called every time that the callout is rendered thus making sure it is up to date. Thanks to jQuery parsing since the data is stored as XML it makes it easy to query the XML to see if the task I am looking for is on the timeline. The data comes back as some pretty ugly all on one line XML. But here it is formatted to make it easier to work with.

<TLViewData>
	<fmtSet>
		<fmt id="0" clr="FFEE2222" thm="0001" t1="0" t2="1" type="0" />
		<fmt id="1" clr="FFEE2222" thm="0001" t1="2" t2="3" type="1" />
		<fmt id="2" clr="FFEE2222" thm="0001" t1="4" t2="5" type="2" />
		<fmt id="3" clr="FFEE2222" thm="0001" t1="6" t2="7" type="3" />
	</fmtSet>
	<fltSet>
		<ft id="{00000000-0000-0000-0000-000000000000}" uid="4294967295" uidSrc="1" onTL="0" fmt="1" y="4294967282" x="0" h="20" />
	</fltSet>
	<tskSet>
		<t id="{00000000-0000-0000-0000-000000000000}" uid="4294967295" uidSrc="1" onTL="0" fmt="0" ch="4294967295" />
		<t id="{D8B18823-A736-4A9A-A804-0BD23BF1552D}" uid="23" uidSrc="1" onTL="1" fmt="0" ch="4294967295" />
		<t id="{52B9A142-C89C-40DC-83C8-33A00CF03B6C}" uid="26" uidSrc="1" onTL="1" fmt="0" ch="4294967295" />
		<t id="{E89E7256-F104-4AA9-BC53-13439E0EAA42}" uid="25" uidSrc="1" onTL="1" fmt="0" ch="4294967295" />
		<t id="{B6074014-2A71-45D5-BBAF-FB0DA2A201A1}" uid="24" uidSrc="1" onTL="1" fmt="0" ch="4294967295" />
		<t id="{C5789532-D420-4C9B-B704-D5CDEA3350EF}" uid="22" uidSrc="1" onTL="1" fmt="0" ch="4294967295" />
		<t id="{EFC756A8-1B16-495C-AB7D-112B31A59534}" uid="21" uidSrc="1" onTL="1" fmt="0" ch="4294967295" />
		<t id="{990078A6-BF87-4121-A720-ACFB1685A8B2}" uid="79" uidSrc="1" onTL="1" fmt="0" ch="4294967295" />
		<t id="{2FFCFA8C-7CD1-429F-BDA6-E6BB4BC3A71C}" uid="80" uidSrc="1" onTL="1" fmt="0" ch="4294967295" />
		<t id="{2D77DD43-A9F6-4B1D-8E6C-12474F3E3CFB}" uid="82" uidSrc="1" onTL="1" fmt="0" ch="4294967295" />
	</tskSet>
	<options dateFormat="3" panZoomT="9" ProjSummFmt="3" showDates="1" showProjSummDates="1" showToday="1" showTS="1" timelineHeight="110" timelineWidth="-1" timescaleT="8" todayT="10" />
	<mlSet>
		<m id="{00000000-0000-0000-0000-000000000000}" uid="4294967295" uidSrc="1" onTL="0" fmt="2" y="35" x="0" />
		<m id="{D8B18823-A736-4A9A-A804-0BD23BF1552D}" uid="23" uidSrc="1" onTL="1" fmt="2" y="17" x="60" />
		<m id="{52B9A142-C89C-40DC-83C8-33A00CF03B6C}" uid="26" uidSrc="1" onTL="1" fmt="2" y="5" x="49" />
		<m id="{E89E7256-F104-4AA9-BC53-13439E0EAA42}" uid="25" uidSrc="1" onTL="1" fmt="2" y="4294967273" x="4294967249" top="1" />
		<m id="{B6074014-2A71-45D5-BBAF-FB0DA2A201A1}" uid="24" uidSrc="1" onTL="1" fmt="2" y="4294967262" x="0" top="1" />
		<m id="{C5789532-D420-4C9B-B704-D5CDEA3350EF}" uid="22" uidSrc="1" onTL="1" fmt="2" y="4294967263" x="0" top="1" />
		<m id="{EFC756A8-1B16-495C-AB7D-112B31A59534}" uid="21" uidSrc="1" onTL="1" fmt="2" y="13" x="33" />
		<m id="{990078A6-BF87-4121-A720-ACFB1685A8B2}" uid="79" uidSrc="1" onTL="1" fmt="2" y="35" x="0" />
		<m id="{2FFCFA8C-7CD1-429F-BDA6-E6BB4BC3A71C}" uid="80" uidSrc="1" onTL="1" fmt="2" y="35" x="0" />
		<m id="{2D77DD43-A9F6-4B1D-8E6C-12474F3E3CFB}" uid="82" uidSrc="1" onTL="1" fmt="2" y="25" x="4294967020" />
	</mlSet>
	<txtSet>
		<style id="0" type="0" clr="FFEE2222" thm="0001" sz="8" font="Segoe UI" bold="0" ital="0" und="0" strk="0" />
		<style id="1" type="1" clr="FFEE2222" thm="0001" sz="8" font="Segoe UI" bold="0" ital="0" und="0" strk="0" />
		<style id="2" type="2" clr="FF999999" thm="0001" sz="8" font="Segoe UI" bold="0" ital="0" und="0" strk="0" />
		<style id="3" type="3" clr="FFB3B3B3" thm="0001" sz="8" font="Segoe UI Light" bold="0" ital="0" und="0" strk="0" />
		<style id="4" type="4" clr="FF525051" thm="0001" sz="10" font="Segoe UI" bold="0" ital="0" und="0" strk="0" />
		<style id="5" type="5" clr="FFB3B3B3" thm="0001" sz="8" font="Segoe UI Light" bold="0" ital="0" und="0" strk="0" />
		<style id="6" type="6" clr="FF999999" thm="0001" sz="9" font="Segoe UI" bold="0" ital="0" und="0" strk="0" />
		<style id="7" type="7" clr="FF999999" thm="0001" sz="8" font="Segoe UI" bold="0" ital="0" und="0" strk="0" />
		<style id="8" type="8" clr="FF999999" thm="0001" sz="8" font="Segoe UI" bold="0" ital="0" und="0" strk="0" />
		<style id="9" type="9" clr="FFFFA614" thm="0001" sz="8" font="Segoe UI Semibold" bold="1" ital="0" und="0" strk="0" />
		<style id="10" type="10" clr="FFFFA72B" thm="0001" sz="10" font="Segoe UI Semibold" bold="0" ital="0" und="0" strk="0" />
	</txtSet>
</TLViewData>

If you look at this XML you can see there is a lot going on. This is where all the position and formatting for the tasks is stored. The part that we care about is under the tskSet node. This node contains all the tasks that have ever been on the timeline on the list. This is important to keep in mind. If you remove a task from the timeline this task will remain in the tskSet node. Luckily it is easy to identify which tasks are on the timeline and which are not by the onTL attribute. Also on the t nodes there is a uid attribute. This is the item ID from the list item. So now that we have this information we can use jQuery to search the xml for us and tell us whether the task is on the timeline or not. Since jQuery parses HTML and for the most part now days HTML is XML, or really XML can be parsed like HTML and jQuery doesn’t care.

Here is out jQuery statement that will check for our task.

jQuery(properties.get_item("Timeline_Timeline")).find("t[uid='" + checkingId + "'][onTL='1']").length == 1

All we are doing is loading the XML into the jQuery parser then we call find on the jQuery object that represents our XML. We then call the find method and pass in selectors that will limit the objects returned to the one we care about. We are looking for all t nodes that have an attribute of uid that equals the id we are checking and an attribute called onTL with a value of one. If this returns any elemens, length greater than zero then the task is on the timeline. So we update the callout to display the appropriate value of Add or Remove. Then when the action is clicked on in the callout we call the appropriate add or remove function.

To me this is a much more elegant solution than changing the XML from the server or client. I’ll let Microsoft deal with their data the way they like. The beauty of this solution as well is that it will work with an on-premise SharePoint installation and it will also work if you want to use it in Office 365 or SharePoint Online.

Please let me know if you have any thoughts or questions.

 

 

IIS Internal Server Error – SharePoint/ASP.Net

I came across an issue at a client I was at and I was banging my head against the wall for a while. So I thought I should share. I was developing an HTTPModule that was being added to the web.config through a SharePoint feature. This part was working fine then all of a sudden the site starting throwing “500 Internal Server Error” messages. So I figured ok, I’ll just check Event Viewer for the machine. What did I find, nothing out of the ordinary. I tried a few other things including completely removing my HTTPModule and still no dice. So I tried resetting IIS, rebooting the machine, none of it worked. So I figured I would double check and make sure the module was removed.

So I went into IIS and selected the web site that I was working with. I then double clicked on the Modules option and was presented with an error “Cannot read configuration file because it exceeds the maximum file size”. So after a quick search on Bing I found that apparently ASP.Net has a limitation that the web.config file cannot exceed 250 KB. So I checked my config file and it was 257 KB. So I trimmed out some duplicated lines caused by another web.config modification from a feature and then the site came back up. So for anyone out there, hopefully this is helpful.

SharePoint Search and PowerShell Automation Script

I was working at a client where we had to rebuild their search service to try and alleviate some issues that they were experiencing and as part of this I came to the realization that manually creating managed properties has got to stop. The problem is that there is no easy way to move service scoped properties from one server to another. Also as a developer, the fact that this is not easily deployed bugs me. I want to be able to deploy the properties consistently. I don’t want to have to go back and create them again and wait for another full crawl because I missed one or typed the name in wrong. What’s worse is there is no way of  putting this configuration into version control to create a baseline configuration. Continue reading “SharePoint Search and PowerShell Automation Script”

Getting SharePoint List Version Setting for all lists

I was working at a client doing a health assessment and during the assessment we talked about problems with users being able to turn on versioning. That being that each time a modification is made it keeps a copy of that file and if versioning is turned on then this can drastically increase your content database sizes pretty quickly. I setup this script to be able to help identify what the settings are. This script could be modified to enforce a policy on what the limits should be as well.

Continue reading “Getting SharePoint List Version Setting for all lists”