Skip to main content

Posts

Showing posts with the label SharePoint

Apply C# code in Power Shell Script

  Apply C# code in Power Shell # ----------- Csharp code for variations -------------- $Assem = (     "System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"    ,     "Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ,     "Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ,     "Microsoft.Office.Server.Search, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ,     "Microsoft.Office.Server, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"             )     $Source = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.SharePoint; using Microsoft.SharePoint.Publishing; using Microsoft.SharePoint.Administration; using Syste...

How to Write An SPQuery Using Multiple AND OR Operators

Writing CAML queries can sometimes make your head hurt. Not because it’s terribly complicated, but because there’s not much useful information out there that demonstrates, with REAL examples, how these should be written. So let’s see if we can clarify this: Scenario 1 Get me all items in a list WHERE fullName equals the currently logged in user. 1 2 3 4 5 6 7 8 9 10 11 SPWeb web = SPControl. GetContextWeb ( Context ) ; string fullName = web. CurrentUser . Name ; SPQuery oQuery = new SPQuery ( ) ; oQuery. Query = "<Where>" + "<Eq><FieldRef Name='FullName'/><Value Type='Text'>'" + fullName + "'</Value></Eq>" + "</Where>" + "<OrderBy><FieldRef Name='StartTime' Ascending='FALSE'></FieldRef></OrderBy>" ; Scenario 2 Get me all items in a list WHERE fullName equals the currently...

Using the SharePoint 2010 Modal Dialog

SharePoint 2010 introduces the new dialog framework which helps users stay in context of the page without navigating away from the page. Yes, the modal dialogs that pop up: The JavaScript client object model provides the  SP.UI.ModalDialog  class to work with the dialog framework. In order to work with the dialog framework, we need to first create the dialog options: var options = SP.UI.$create_DialogOptions(); options.width = 500; options.height = 250; options.url = "/_layouts/StandardsPortal/ChangePassword.aspx" ; options.dialogReturnValueCallback = Function.createDelegate( null , portal_modalDialogClosedCallback); As you can see from the above code, we set options on width, height and what is the URL the modal dialog should load. In this case, an Application Page. Notice that we also initialize the callback. Once the options are set, you can now show the modal dialog: SP.UI.ModalDialog.showModalDialog(options); Now warp this code into a funct...

Integrating Sharepoint 2010 and SQL Reporting Services 2008

There are only 6 main steps to achieve this task assuming you already have an instance of SQL Server Reporting Services and Sharepoint 2010. I had created this starting from a clean installation of SQL Reporting Services so this guide will discuss the steps on configuring your SQL Reporting Services 2008 for integration with Sharepoint 2010. Step 1 : Configuring SQL Reporting Services – Web Service URL. Simply go to Reporting Services Configuration Manager and choose Web Service URL and populate the following needed information. The fields are named properly so I guess theres no need for further explanation.  What this does is that it configures the IIS for you depending on what Virtual Directory names you had declared Step 2 : Configuring SQL Reporting Services – Create a Report Database Same here fields need no further explanation except for one which is Native Mode and Sharepoint Integrated mode which I will explain below. Choose create a database or if you alrea...

Setting Up PerformancePoint Services in Sharepoint 2010

I recently got very frustrated trying to get PerformancePoint Services to work on a fresh Sharepoint 2010 installation. Dashboard designer just wouldnt connect to the sharepoint site. Event viewer showed errors along the lines of “There are no addresses available for this application”. This same error appeared to affect a lot of other items such as the Secure Store Service, Excel Services etc. So i eventually got it working and can say the following need to be done. A similar proces will apply to other similar service applications. The most important step.. and my main problem: make sure your services are enabled at the server level! Central Admin -> (System Settings) ->Manage Services on Server: Add the Secure Store Service: Central Admin -> (Application Management) ->Manage Services Applications. then Select New -> Secure Store Service. Configuration asks you for a database name and credentials. Add the PPS service application: Central Admin -> (Ap...

Running Timed Jobs within SharePoint

Programming a Timed Job The Job installed in the aforementioned paragraph does not actually work because there is no "logic" to execute. To create a new Job, it is necessary to program a new class library and add it to the Global Assembly Cache (GAC) to make the logic accessible to SharePoint. The first step is to create a new "Class Library" Visual Studio 2005 project with a suitable name, then add a reference to Windows SharePoint Services (Microsoft.SharePoint.dll) and "using" directives to Microsoft.SharePoint and Microsoft.SharePoint.Administration. The Class needs to inherit from "SPJobDefinition" and to have at least one constructor to initialize the new objects. The definition of the empty class reads: using System; using System.IO; using Microsoft.SharePoint; using Microsoft.SharePoint.Administration; namespace CountDocs { public class CountDocsJob : SPJobDefinition { public CountDocsJob() { } //public C...