Archive
Retrieving the Project GUID with JavaScript CSOM #PS2013 #PS2010 #MSProject #Office365 #in
So the Microsoft Office preview is out and unfortunately my colleagues and I are still consulting on current and previous versions, so only limited time around client work allows for play. Luckily we have had access to earlier versions for several months now so as a company Corporate Project Solutions is prepared for 2013 and we are even running knowledge sessions and upgrade validation checks.
Moving on… whilst in the hotel, we started playing with Napa and the possibilities around what can and can’t be done.
Although this example is not relevant to Napa (due to the environment the apps run in), we did manage to product some code that would be useful for Sandbox Solutions or Composite solutions using the Content Editor Web Part in Project Online, Project Server 2013 and potentially Project Server 2010.
In this example, we use the SharePoint Client Side Object Model to view the property bag within a Project Site to retrieve the following:
- Internal Project UID
- Project Wep App URL
- Project Web App Site UID.
NB: The Project UID is for the plan associated within to the site in Project Server.
The Result
SharePoint CSOM code running within a Project Site in Project Online (Office 365 Preview)
Closer look at the output
So you may be wondering, why we need this information. Well with the introduction of Project Online / Project Server 2013, the client side object model can interact with the PSI to return Project and Resource data.
In many cases you will need the Project UID as a starting point!
Here are the details of getting things up and running in the IE Development Toolbar
and trust me, there is much more CSOM goodness to come.
Final Code Example:
function getWebProperty() { var ctx = new SP.ClientContext.get_current(); this.web = ctx.get_web(); this.props = this.web.get_allProperties(); ctx.executeQueryAsync( Function.createDelegate(this, gotProperty), Function.createDelegate(this, failedGettingProperty) ); } function gotProperty() { alert("Project UID: " + this.props.get_fieldValues()["MSPWAPROJUID"] + "\nPWA URL: " + this.props.get_fieldValues()["PWAURL"] + "\nPWA Site UID: " + this.props.get_fieldValues()["MSPWASITEUID"] ); } function failedGettingProperty() { alert("failed"); } getWebProperty();
Debug Code Example:
To get this detail out, me and my colleague had to do some digging in the object model using debug code to alert out to the console values at the Web and Property object areas:
function getWebProperty() { var ctx = new SP.ClientContext.get_current(); for(var p in ctx) { console.log("T: " + p); } this.web = ctx.get_web(); this.props = this.web.get_allProperties(); ctx.load(this.web); ctx.load(this.props); ctx.executeQueryAsync( Function.createDelegate(this, gotProperty), Function.createDelegate(this, failedGettingProperty) ); } function gotProperty() { //alert(props.isPropertyAvailable('allowdesigner')); for(var itm in this.web){ console.log(itm); } for(var prop in props){ console.log(prop); } for(var fv in this.props.get_fieldValues()) { console.log(fv); } alert(this.props.get_fieldValues()["MSPWAPROJUID"]); } function failedGettingProperty() { alert("failed"); } getWebProperty();
Example References
Just in case you need to add sources for JavaScript frameworks. Here are some references below:
<script type="text/ecmascript" src="/_layouts/SP.Core.js" /> <script type="text/ecmascript" src="/_layouts/SP.Debug.js" /> <script type="text/ecmascript" src="/_layouts/SP.Runtime.Debug.js" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" />
Presenting and staffing at TechEd Europe 2012 next week #TEE12
Just a quick blog post to say that I will be presenting at TechEd Europe 2012 next week with my slide deck:
Integrating Project Server & SharePoint 2010
Deployment Approaches, Integration Options
& making the most of the SharePoint Enterprise Features
Code: OSP02-LNC
- Level: 300
- Category: Office, Office 365 & SharePoint
- Presenter: Giles Hamson
- Date: Wednesday, June 27th 2012
- Time: 13:30 to 14:15 (45 mins)
- Location: Hall 2
The key focus of this session is to understand three popular approaches to implementing SharePoint and Project Server together and the key benefits to each method.
In addition you will also learn:
- Understanding how SharePoint and Project Server work together
- Using the enterprise features of SharePoint to leverage Project Server data
- How SharePoint and Project Server techniques differ and can cause issues with implementation
I will also be staffing the Microsoft stand to discuss Project Server, Project, SharePoint & Office with anyone who stops by. So if you have any questions about the product set or you just want to say hello, come along.
My Schedule:
- Tuesday: Booth 13:30 till 15:30
- Wednesday: Presentation 13:30 till 14:15 (link)
- Flight out Wednesday night – Airport for 7pm ish.
Look forward to seeing you there!
Project Conference 2012 video presentations now available #PS2010 #ProjectServer #MSProject #in
Over the past couple of months, you may have seen posts about my presentation at the Project Conference held in Phoenix, AZ. Now that some time has passed, Microsoft has uploaded all the video presentations to the Project channel on Microsoft Showcase.
The Project team officially announced the availability here.
As part of the Microsoft Project Conference 2012, Corporate Project Solutions (my company) not only sponsored my presentation, but also the client I have been working for over the last couple of years, ARM.
So without further ado, I offer both video presentations for your consideration:
URL: http://www.microsoft.com/en-us/showcase/details.aspx?uuid=06fff348-8836-497b-a5eb-b5ed63a3b6c9
URL: http://www.microsoft.com/en-us/showcase/details.aspx?uuid=17a5610c-8d0f-49f2-869c-d6d1021d472a
If you would like to skim through the slides, I have uploaded them to SlideShare for your convenience:
Integrating SharePoint and Project Server 2010
8 Billion Reasons… Why ARM Chose Project Server 2010
Enjoy and if you have any questions about the above or would like to know more, please get in contact!
Using the “Inactivate Tasks” functionality
Inactivate task is a new feature for EPM2010; this feature enables the project manager to set certain tasks to inactive rather than deleting the tasks. This functionality is also useful for performing what-if analysis.
The following paragraph from Microsoft explains that intended usage of the inactivate task functionality:
“Microsoft Project Professional 2010 enables you to cancel a task but keep a record of the task in the project plan. This is called inactivating the task. The task remains in the project plan, but does not affect resource availability, the schedule or how other tasks are scheduled. Note: Inactivating a task is a feature available only with Project Professional.
Why would you want to inactivate a task? For one thing, it can help you model the effects of schedule or resource constraints on the project without deleting tasks permanently. Also, inactive tasks remain in the project plan, providing a record of cancelled tasks and enabling you to reactivate them if circumstances change.
Note: Inactivation is nor a good way to archive complete tasks, because it could have unanticipated effects on the remaining schedule. Instead, mark the tasks as completed.”
http://office.microsoft.com/en-us/project-help.inactivate-a-task-HA010370341.aspx
Please see the following best practise guidelines for using inactive tasks:
- When in the planning phase, if you decide that a task or tasks are not required, at this stage use the inactivate task feature to set tasks to inactive rather than deleting the tasks. this will give you the option to quickly make these tasks active at a later date if there is a requirement for these tasks.
- Inactive tasks do not affect resource availability. Baseline values that have already been taken are retained, but any new baselines taken will not include data for inactive tasks.
- Tasks that have actual work cannot be made inactive.
- Inactive tasks are not published, so inactive task assignments will not appear on a team member’s task list.
- Inactive tasks are available to report on via the Project Server OLAP cube, so care should be taken when reporting that these tasks are/aren’t included depending on the figures required. The “Task is Active” field can be used to include or exclude inactive tasks. If you do not see this field in your OLAP cube, it may be that the EPM administrator has not enabled inactive tasks in the cube.
#SP2010 #PS2010 Performance Links
Some useful links for Capacity Performance and Management
SharePoint 2010
Capacity management and sizing overview
http://technet.microsoft.com/en-us/library/ff758647.aspx
Software boundaries and limits
http://technet.microsoft.com/en-us/library/cc262787.aspx
Performance and capacity test results / recommendations
http://technet.microsoft.com/en-us/library/ff608068.aspx
Performance and capacity technical case studies
http://technet.microsoft.com/en-us/library/cc261716.aspx
InfoPath Form Services – performance and capacity requirements
http://technet.microsoft.com/en-us/library/gg576954.aspx
Project Server 2010
Plan hardware architecture
http://technet.microsoft.com/en-us/library/hh297440.aspx
Software Boundaries (Project Server 2007)
http://technet.microsoft.com/en-us/library/cc197693(v=office.12).aspx
SSRS Web Part Performance 2008 R2 vs. 2012 Initial Results #SharePoint #SP2010 #in
On one of my client projects, we heavily use SQL Server Reporting Services in SharePoint integration mode.
The benefits in comparison to Native mode are primarily around the RS SharePoint Add-in which allows us to use query string (URL) filter web parts to pass parameters to reports and create powerful dynamic dashboards as well as using SharePoint to permission and store the reports.
There is an issue however. Performance in this mode is not amazing, as detailed here:
- http://sqlcat.com/sqlcat/b/technicalnotes/archive/2010/11/03/reporting-services-performance-in-sharepoint-integrated-mode-in-sql-server-2008-r2.aspx
- http://connect.microsoft.com/SQLServer/feedback/details/635080/ssrs-2008-r2-and-sharepoint-2010-performance-issues
- http://www.sqlchick.com/entries/2011/1/25/whats-up-with-the-slow-ssrs-r2-rendering-in-sharepoint-2010.html
- http://blogs.msdn.com/b/prash/archive/2011/06/11/performance-of-ssrs-in-sharepoint-mode-reports-in-full-page-view-in-sharepoint-2010.aspx
Now that SQL Server 2012 has gone to RTM, we can start to get a measure of how well the new web part performs and I am pleased to say that the improvements appear to be great so far…
The Scenario
- SharePoint Version: 2010 SP1 – December 2011 CU with Project Server
- DB Server: SQL Server 2008 R2 SP1
- SSRS Version: 2008 R2 SP1
- SSRS Add-in: 2012 (Denali) – RTM
- Server Architecture: 1 x WFE / App Server (Virtual) + 1 x SQL Server (Virtual)
NB: All testing has been carried out on our DEV server, please always try out new software on a development / test environment first to ensure the benefits and to safe guard production from issues.
The Reports:
Table based reports rolling up Project Server and SharePoint data based on parameters provided by the end user (Cannot show due to client confidentiality I’m afraid).
The Results:
Now this is just a teaser really since we will be doing full testing on our master development environment, but for now…
Project Portfolio Table Report
- Number of returns items: 17 rows
- Number of parameters: 1 (Portfolio ID)
NB: All time taken in seconds using Fiddler2
As you can see, we are seeing significant time increases with the new web part and within my client we have the go ahead to carry out further testing.
More useful links:
- SSRS 2012 Installation – Liam Cleary: http://blog.helloitsliam.com/Lists/Posts/Post.aspx?ID=66
- Installing SSRS 2012 without upgrading your DB Server: Todd Klindt: http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=324
- MSDN: http://technet.microsoft.com/en-us/library/hh231671.aspx
#SP2010 web part rounded corners #SharePoint #PS2010 #ProjectServer #MSProject #in
At one of my clients I was asked to document how we achieved rounded corners on web parts. So as a result, I figured a blog post about it would be useful.
Now when I first implemented this (almost 2 years ago!) as the 2010 product RTM’d, I based it on the only blog post around at the time:
- The end result looks like this:
NB: Please note that this version is slightly modified from the version supplied on the blog link above.
In my implementation I was using the jQuery version available at the time:
- jQuery 1.5.1
- jQuery UI 1.8.13
Although jQuery UI is not required, it is always good to have for those awesome calendar pop-ups just in case.
This may work with the newer versions of jQuery, but I haven’t tried it out yet.
Example CSS, JavaScript and rounded corner image files are provided at the bottom of the post.
So without further ado, lets go through how to achieve the rounded corners in SharePoint 2010:
What does the code actually do?
With every page refresh, the JavaScript code, determines where all the web parts on the page are and injects appropriate mark up (<DIV>) above and below each web part, ready to be styled by CSS.
Step 1. Upload your reference files
Personally I like to store all my custom files within the Style Library within SharePoint, but they can live anywhere within SharePoint as long as all users have read access to them.
So lets take a look at what we are storing.
Standard Plug-In Files:
- jquery-ui-1.8.13.custom.css
- jquery-1.5.1.min.js
- jquery-ui-1.8.13.custom.min.js
You can download this version here:
- jQuery: http://docs.jquery.com/Downloading_jQuery#Past_Releases
- jQueryUI: http://jqueryui.com/download
The latest versions are available here:
Custom Files
- <custom JavaScript file>.js
- <custom CSS file>.css
These files are where we will implement the JavaScript and CSS code to produce the rounded corners on each web part.
Corner Image Files
The following files are used to create the rounded corner affect. To keep multi-browser support we are using this method, but you could replace them with CSS3 styling by changing the CSS code to achieve the same result.
- WPBottomLeft.gif
- WPBottomRight.gif
- WPTopLeft.gif
- WPTopRight.gif
Example files are provide below.
Step 2. Add your Master Page file references
Initially add the following references into <head> section of your Master Page, preferably just before the end tag </head>
<link type="text/css" href="/Style Library/jquery-ui-1.8.2.custom.css" rel="Stylesheet" /> <script src="/Style Library/jquery-1.4.2.min.js" type="text/javascript"></script> <script src="/Style Library/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
Now the above references are just standard plug-ins available from the jQuery website, but we also need to add some of our own JavaScript / jQuery magic, which of course needs its own reference file.
<script src="/Style Library/<customJavaScriptFile>.js" type="text/javascript"></script>
We also need to reference a custom CSS file, so that we can associate the corner images we will be using etc…
Publishing Feature enabled?
Now if you are using the Publishing feature, you can place your custom CSS via the Site Settings interface:
Site Actions > Site Settings > Under Look and Feel – Click “Master Page”
- (http://<server url>/_Layouts/ChangeSiteMasterPage.aspx)
Under the “Alternate CSS URL”, enter the URL for your custom CSS file, for example:
- /style library/<customCSSFile>.css
- NB: This will ensure it is the last CSS file referenced within the Master Page to allow for overrides.
Publishing Feature not-enabled?
If you you do not have the publishing feature enabled (Office 365 P1 or SharePoint Foundation 2010 for example), you can add the reference into the Master Page also.
<link type="text/css" href="/Style Library/{customCSSFile}.css" rel="Stylesheet" />
Step 3. Adding the code
So now that we have our JavaScript, jQuery and CSS files setup in the Master Page, we can edit out custom files with the following code:
CSS Code (customCSSFile.css)
/* Web Part Chrome Styles – START */
.wpContainer {
padding-bottom:0px !important;
}
.wpTitleBorder, .wpBorderOnly {
background-color:#fff !important;
border-left:1px solid #c6c6c5 !important;
border-right:1px solid #c6c6c5 !important;
}
.ms-WPHeader td {
background-color:#ffffff !important;
border:0 !important;
padding:0 !important;
padding-top: 3px !important;
border-bottom: 1px #CECFCE solid !important;
}
h3.ms-WPTitle {
/* color:#36424a !important; */
font-size:15px !important;
font-weight:normal !important;
margin:-3px 0 0 0px !important;
padding:0 14px 4px 4px !important;
}
h3.ms-WPTitle a {
/* color:#36424a !important; */
font-size:15px !important;
font-weight:normal !important;
}
h3.ms-WPTitle nobr {
white-space:normal !important;
}
.ms-WPHeader td div.ms-HoverCellInActive {
margin:0 !important;
*padding:0 0 2px 0 !important; /* IE <8 fix */
}
.ms-WPHeader td .ms-HoverCellInActive {
margin:0 !important;
*padding:0 0 2px 0 !important; /* IE <8 fix */
}
.ms-WPHeader td .ms-HoverCellInActive img {
margin:0 0 2px 0 !important;
*margin:0 !important; /* IE <8 fix */
}
.ms-WPHeader img.ms-HoverCellInActive { /* Firefox */
padding:0 0 2px 0 !important;
}
.ms-WPHeader td .ms-HoverCellActiveDark {
border:0 !important;
margin:0 !important;
padding:0 0 2px 0 !important;
}
td.ms-WPBorder, td.ms-WPBorderBorderOnly {
border:0 !important;
padding:0px 0px !important;
}
.ms-WPBody {
font-family:Tahoma, arial, sans-serif !important;
font-size:11px !important;
padding:0 !important;
}
.ms-WPBody td, .ms-WPBody TD DIV, .ms-WPBody TD DIV A {
font-family:Arial, Tahoma, sans-serif !important;
font-size:11px !important;
}
.wpCornersTop {
background:url('/blog/Style Library/Images/WPTopRight.gif')
top right no-repeat !important;
height:10px !important;
padding-right:10px !important;
}
.wpCornersTop div {
background:url('/blog/Style Library/Images/WPTopLeft.gif')
0 0 no-repeat !important;
height:10px !important;
}
.wpCornersBtm {
background:url('/blog/Style Library/Images/WPBottomRight.gif')
bottom right no-repeat !important;
height:11px !important;
padding-right:11px !important;
}
.wpCornersBtm div {
background:url('/blog/Style Library/Images/WPBottomLeft.gif')
0 0 no-repeat !important;
height:11px !important;
}
/* Web Part Chrome Styles - STOP */
JavaScript / jQuery Code (customJavaScriptFile.js)
function wrapWebParts() { //Find all divs (div.ms-WPBody) with an ID beginning //with "WebPart". All web parts have unique IDs assigned //to them, and they begin with "WebPart". Then traverse up //the HTML document 4 levels and add the class "wp". $('td[id*=MSOZoneCell_WebPart]').children("table").addClass("wp"); //For web parts with the Title and Border chrome, //add the class "wpTitleBorder" to the element //with class "wp". $(".ms-WPBorder").parents(".wp").addClass("wpTitleBorder"); //For web parts with the Border Only chrome, add the class //"wpBorderOnly" to the element with the class "wp". $(".ms-WPBorderBorderOnly").parents(".wp").addClass("wpBorderOnly"); //Find all table cells that have an ID beginning with //'"MSOZoneCell" and add the class "wpContainer". $("td[id^=MSOZoneCell]").addClass("wpContainer"); //For web parts with the chrome type Title and Border or Border Only, //add containers that can be used for rounded corners and other //treatments //alert($(".wpTitleBorder").length); $(".wpTitleBorder").before('<div class="wpCornersTop"><div></div></div>') .after('<div class="wpCornersBtm"><div></div></div>'); $(".wpBorderOnly").before('<div class="wpCornersTop"><div></div></div>') .after('<div class="wpCornersBtm"><div></div></div>'); $("img[src*=/_layouts/images/blank.gif]") .attr("style", "display: none;"); $('div[class=wpCornersBtm]').each(function() { var mainWPTable = $(this).prev(); var inlineWidthStyle = mainWPTable.attr("style"); var realWidthSplit = ""; var realWidth = ""; if (inlineWidthStyle != undefined) { realWidthSplit = inlineWidthStyle.split(":"); realWidth = realWidthSplit[1].toLowerCase(); realWidth = realWidth.replace("px", ""); realWidth = parseInt(realWidth, 10); realWidth = realWidth + 13; $(this).attr("style", "width: " + realWidth + "px"); $(this).prev().prev().attr("style", "width: " + realWidth + "px"); } }); } $(document).ready(function(){ wrapWebParts(); });
And Finally…
The end result is this:
If we break this down, the jQuery code has discovered each web part on the page, added a <div> above and below the web part and then the CSS has styled it with the supplied image files referenced in the style sheet.
The code also takes into account the chrome type being used on the web part:
This results in the following:
Chrome Type: None
Chrome Type: Title and Border
Chrome Type: Title Only
Chrome Type: Border Only
Code Downloads:
Project Server – "An unknown error has occurred"
I recently had an issue at a client where the Project Center was failing to load and returning “An unknown error has occurred” on the page. We have seen this behaviour before and it’s usually some corrupt Project data that causes it, but I’ve never had the time to get to the bottom of the problem. Fortunately, today I had a bit more free time to investigate.
This particular issue is caused by custom fields that are linked single value (read: not multi-select) lookup tables erroneously getting multiple values assigned to them. How this occurs is as-yet unclear, but it appears to be symptomatic only in the published database – the draft and reporting databases are unaffected.
So, what’s the fix?
There are a couple of things that can be done, depending on your level of access and technical capability. Firstly, we need to identify the plans that are causing the issue. The fastest way of doing this is with a little piece of SQL code (change <Published_DB_name> to your actual Project Server published database name):
USE <Published_DB_name> SELECT (SELECT proj.PROJ_NAME FROM dbo.MSP_PROJECTS proj WHERE pcf.PROJ_UID = proj.PROJ_UID) as ProjectName ,(SELECT pcfv.[MD_PROP_NAME] FROM [dbo].[MSP_CUSTOM_FIELDS] pcfv WHERE pcfv.[MD_PROP_UID] = pcf.MD_PROP_UID) as CustomFieldName ,count(*) FROM [dbo].[MSP_PROJ_CUSTOM_FIELD_VALUES] pcf GROUP BY PROJ_UID, MD_PROP_UID HAVING COUNT(*) > 1 ORBER BY ProjectName, CustomFieldName
(credit to Jan @ Piet Remen’s blog for the above query – http://pietremen.blogspot.co.uk/2012/01/project-centre-unknown-error-has.html)
This will return a list of projects, custom fields and the number of times that the custom field has been populated. If any project appears as an output of this script, you can view view the issue by taking a look at the Project Information through PWA. Affected custom fields will appear comma separated – e.g. Project Priority: Low, Low, Low, Low – where they should only appear as a single value.
The fix is quite a simple one – republish the project. This pushes the values from the draft database back to the published database and overwrites the broken custom field values. Check in PWA > Project Information, or re-run the above query to check that the plan is now fixed in the published database. I have seen a couple of instances where this did not fix the problem, and we had to delete the published version of the plan, and re-publish from the draft version.
It is still unclear how long the project will remain “fixed”, we have had a couple of plans reproduce the issue after being republished.
Microsoft have identified the issue, and released a fix, which can be found here: http://support.microsoft.com/kb/2598251
This KB is also included in the roll-up package (http://support.microsoft.com/kb/2597152) though it’s not documented.
These KB’s will prevent the issue occurring in the future, but will not fix existing problems – be sure to follow the above steps to ensure that the plans are fixed. As always – be sure you have database backups before applying updates!
#ProjectServer 2010 / 2007 high-level Audit Export via #PowerShell #MSProject #PS2010 #EPM
Quite often there is a request for audit information from Project Server but unfortunately there is nothing available out of the box. This post covers a very high-level solution to this using the Project Server PSI and PowerShell.
Most actions in Project Server are processed via the Project Server queue, one simple way to get high-level audit information is to extract the queue information. The following PowerShell script uses the ReadAllJobStatusSimple method from the Queue System web service to export yesterdays processed jobs into a txt file with yesterday date appended to the filename:
$Today = Get-Date
$Yesterday = $Today.AddDays(-1).ToString("yyyy-MM-d")
$Filename = "C:\PSAuditExport\QueueExport-"
$filetype = ".txt"
$svcPSProxy = New-WebServiceProxy -uri "http://vm353/pwa/_vti_bin/PSI/QueueSystem.asmx?wsdl" -useDefaultCredential
$svcPSProxy.ReadAllJobStatusSimple("$Yesterday 00:00:01", "$Yesterday 23:59:59", "200", "0", "QueueCompletedTime" ,"Ascending").Status | Export-CSV $Filename$Yesterday$filetype -Delimiter "|"
For the full post please see:
#SP2010 and #PS2010 versions and the associated KB articles #SharePoint #ProjectServer #in
Following on from my colleagues post on finding the SharePoint Build Version via PowerShell (Link), I would just like to draw your attention to a list of SharePoint / Project Server versions that I maintain.
Links to the KB articles are also available along with the build version and the Cumulative Update / Service Pack that they are associated with.
How to access:
In the top menu of the site:
Screenshot:
I know that other people maintain similar lists, this is just my way of keeping on top of the versions for SharePoint and in particular Project Server.
Hopefully this is useful for others also.
Enjoy!




