SPT Blog

How to find which version of SharePoint 2010 is installed

http://msdn.microsoft.com/en-us/library/ff721969.aspx Go to the registry key: Regedit HKEY_LOCAL_MACHINE -SOFTWARE-MICROSOFT    SHARED TOOLS-Web Server Extensions - 14.0            WSS-Installed Products Then, match the key that is installed in the list below.                "BEED1F75-C398-4447-AEF1-E66E1F0DF91E", "SharePoint Foundation 2010" "1328E89E-7EC8-4F7E-809E-7E945796E511", "Search Server Express 2010" "B2C0B444-3914-4ACB-A0B8-7CF50A8F7AA0", "SharePoint Server 2010 Standard Trial" "3FDFBCC8-B3E4-4482-91FA-122C6432805C", "SharePoint Server 2010 Standard" "88BED06D-8C6B-4E62-AB01-546D6005FE97", "SharePoint Server 2010 Enterprise Trial" "D5595F62-449B-4061-B0B2-0CBAD410BB51", "SharePoint Server 2010 Enterprise" "BC4C1C97-9013-4033-A0DD-9DC9E6D6C887", "Search Server 2010 Trial" "08460AA2-A176-442C-BDCA-26928704D80B", "Search Server 2010" "84902853-59F6-4B20-BC7C-DE4F419FEFAD", "Project Server 2010 Trial" "ED21638F-97FF-4A65-AD9B-6889B93065E2", "Project Server 2010" "926E4E17-087B-47D1-8BD7-91A394BC6196", "Office Web Companions 2010"

By |2011-10-18T20:10:38+00:00October 18th, 2011|Uncategorized|0 Comments

How to add directly to the Workflow History from a custom SharePoint workflow

This one was a little hard to track down. How do you write directly to the SharePoint workflow history? It's easy enough to add a LogToHistory activity and set the HistoryDescription and HistoryOutcome, but what if you want to create those entries dynamically? After toying around with different ways of trying this, the answer was pretty easy: Here's the code sample: SPMember usermember = workflowProperties.OriginatorUser; SPWorkflow.CreateHistoryEvent(this.workflowProperties.List.ParentWeb, this.workflowId, 0, usermember, TimeSpan.MinValue, "Corp Legal Reviewed", "Status Change", string.Empty);

By |2011-09-12T03:29:28+00:00September 12th, 2011|Sharepoint on Premise|7 Comments

How to pull the email addresses from a SharePoint User field (allow multiple users)

To pull the user information, you first have to convert the field into a SPFieldUser object, and then create a collection of the SPFieldUserValueCollection. Then, loop through the collection and pull the Email property of the SPFieldUserValue. code sample: ---------------------------------------------------------------------- string sFieldNameTo = "BU Legal To Email"; string sFieldNameCC = "BU Legal CC Email"; //Add To and CC based on multiple user field if (workflowProperties.Item[sFieldNameTo] != null) { SPFieldUser UsersColumn = (SPFieldUser)workflowProperties.Item.Fields.GetField(sFieldNameTo); SPFieldUserValueCollection Users = (SPFieldUserValueCollection)UsersColumn.GetFieldValue(workflowProperties.Item[sFieldNameTo].ToString()); foreach (SPFieldUserValue fieldUser in Users) { if (fieldUser.User.Email != null && fieldUser.User.Email != string.Empty) { mail.To.Add(fieldUser.User.Email); }// }// }// if (workflowProperties.Item[sFieldNameCC] != null) { SPFieldUser UsersColumn = (SPFieldUser)workflowProperties.Item.Fields.GetField(sFieldNameCC); SPFieldUserValueCollection Users = (SPFieldUserValueCollection)UsersColumn.GetFieldValue(workflowProperties.Item[sFieldNameCC].ToString()); foreach (SPFieldUserValue fieldUser in Users) { if (fieldUser.User.Email != null && fieldUser.User.Email != string.Empty) { mail.CC.Add(fieldUser.User.Email); }// }// }//   Updated 5/11/16 For CSOM use this: foreach (FieldUserValue userValue in item["MultiUser"]as FieldUserValue[]) { }//    

By |2016-05-11T23:05:17+00:00September 12th, 2011|Sharepoint on Premise|1 Comment

Adding MyLinks Programattically in C#

Had a recent issue after migrating our users from one domain to another.  Their MyLinks did not come over after running stsadm migrateuser.  Found the links in the database and wrote a quick winforms app to move them over.  Permissions need to be allowed in Central Admin, Shared Services,  personalization services as well as site col admin on SSP. Here's how to populate them: Extract the MyLinks information from the database Create a Winforms App Add a web reference to the webservice Concatenate the extracted data into a comma separated list in excel Run the app 1.  In SQL, join the UserLinks table in the SSP database with the UserProfile_Full table to get a list of links: SELECT     UP.NTName, UP.PreferredName, UP.Email, UL.Id, UL.RecordId, UL.Title, UL.GroupType, UL.GroupTitle, UL.Url, UL.ContentClass, UL.PolicyId, UL.ItemSecurity FROM         UserLinks AS UL INNER JOIN                       UserProfile_Full AS UP ON UL.RecordId = UP.RecordID domainjsmith  Home  http://site/Pages/Default.aspx General  1  domainjsmith  Yahoo  [...]

By |2022-12-11T19:44:49+00:00June 22nd, 2011|Sharepoint on Premise|0 Comments

Querying Sharepoint List Item Versions using SQL

The request was simple enough, get the total number of days for a status change from one custom list field to another custom list field  in a Sharepoint List Item. There's a few ways to do this. Assume you have a Sharepoint workflow that changes a list item through various statuses and various fields. A simple way is to create a Date Changed field for each field that you want to track, then to populate it in your workflow as it goes along. If you don't have date fields set up in your list, you can take advantage of the version history if version history is turned on. The key here is to loop through your list items, know which field is the field you want, and then take the first version where the value has changed to the desired value. For example, if you are waiting for a "Status" [...]

By |2022-12-11T19:44:49+00:00April 26th, 2011|Sharepoint on Premise|10 Comments

Creating a new version of a custom Sharepoint workflow

This is more for my benefit as a reminder of steps, but if you use Makecab.exe for your .wsp packages, it is important to install new versions that don't step on old versions.  I keep old versions set to "No New Instance" and then New versions pick up the new version of the workflow. New Version of Sharepoint workflow using a .wsp Package Solution – add Solution folder “Deploy” Add Manifest.xml (xml) Add Solution.ddf (text)   1. Manifest.xml – change SolutionID using New Guid 2. Manifest.xml-change Destination Location folder to include version number. 3. Change Assembly version to next version, Properties, Application, Assembly Information 4. Solution.ddf – change CabinetNameTemplate 5. Solution.ddf – increment version on Feature Folder name (2nd name, leave first folder same since this is the source folder). 6. Feature.xml, change feature ID to new GUID. 7. Feature.xml- change Title to include version number 8. Feature.xml-Change Description to include version number 9. Workflow.xml –Change Name  to include [...]

By |2011-03-01T23:47:47+00:00March 1st, 2011|Sharepoint on Premise|0 Comments

Stupid attachments in Sharepoint, adding email attachments

You would think taking  attachments from a  Sharepoint list and adding them to a mail message would be easy.  Well, not that easy.  They make you jump through hoops and stream the attachment with the file name.  Would have been nice to just take an attachment off a list and then add it to an email using the same attachment object.  Oh well.  Here's the code I use to take an attachment off a list item, look at the file name, then attach it to an email using System.Mail.  MailMessage mail = new MailMessage();   SmtpClient smtp = new SmtpClient this.workflowProperties.Web.Site.WebApplication.OutboundMailServiceInstance.Server.Address);   mail.Subject = "Subject" mail.To.Add(wfConfig.EmailTo); mail.CC.Add(wfConfig.EmailCC); mail.From = new MailAddress(wfConfig.EmailFrom); mail.Body ="body": mail.IsBodyHtml = true;    //Attachment(s)      if (workflowProperties.Item.Attachments.Count > 0) {       foreach (string fileName in workflowProperties.Item.Attachments)      {       SPFile file = workflowProperties.Item.ParentList.ParentWeb.GetFile(           workflowProperties.Item.Attachments.UrlPrefix + fileName);                if (file.Name.ToUpper().Contains(DocNameToCheck))           {             Attachment attachment = new Attachment(file.OpenBinaryStream(), [...]

By |2011-01-25T21:35:47+00:00January 25th, 2011|Uncategorized|4 Comments

The Sharepoint way for Application Error Alerts

 By creating a list of application errors, you can take advantage of all the Sharepoint goodness like metadata, alerts, etc.  This post shows how to add a complete Error Management system for custom sharepoint errors, with alerts .  It’s really pretty simple, use the existing Sharepoint lists and alerts to help you stay up to date with any application errors. Create a list to hold your application errors.  See below for a screenshot. Title Application URL Message Inner Exception Source Stack Trace   click to expand  2. From your custom code, create a utility method (I usually have this in a utility class) to add items into the Application Error list.  Pass in the Error, the url, the Title, and the url to your web that contains the error list.  I tend to use constants as much as I can. Note that I also write the error into the Event Log, [...]

By |2022-12-11T19:44:49+00:00January 25th, 2011|Sharepoint on Premise|0 Comments

How to get SSRS Report Usage from Sharepoint in Sharepoint Integrated Mode

SQL Reporting Services in Sharepoint Integrated Mode (MOSS 2007) has always been a little quirky to install, but can be very convenient to organize reports, by leveraging all the Sharepoint metadata, permissions, grouping, filtering and other user interface features. Reporting Services defaults to 60 days for the execution log.  To change it, go to Central Administration, Application Management, Reporting Services, Set Server Defaults and change the Report Processing Log. To find out how often reports are being used in your sharepoint installation, you can query the RSSharepoint.Catalog table, join on the Execution Log, and then join against the SP databases to get the metadata for the reports.  Below is a sample query: (replace list ID with your Report Library list ID)  --Gets metadata from SP database Use WSS_Content_XX_DB1 SELECT  A.tp_leafname As RDL, A.ntext2 as Description, A.ntext3 as Business_Group, A.ntext4 as Application INTO #Temp1 FROM AllUserData A INNER JOIN AllLists L ON [...]

By |2022-12-11T19:44:49+00:00January 19th, 2011|Sharepoint on Premise|0 Comments

Microsoft Support Lifecycles

As developers we always look for the latest technology, but after many years, clients tend to keep applications beyond their expected time.  I am lucky? enough to have an application that has been in use for close to 10 years.  The problem with this is that the underlying server software is no longer supported and we have to migrate the application. So, the decision is keep it on an unsupported platform, or move to a newer platform. Here's the site that shows the support dates for MS products: http://support.microsoft.com/lifecycle/search/default.aspx?sort=PN&alpha=windows&Filter=FilterNO Here's a sample of the support lifecycles: Windows Server products are at the top and all the Sharepoint products are at the bottom. Products Released General Availability Date Mainstream Support End Date Extended Support End Date Service Pack Support End Date Windows 2000 Advanced Server 3/31/2000 6/30/2005 7/13/2010   Windows 2000 Datacenter Server 11/13/2000 6/30/2005 7/13/2010   Windows 2000 Professional Edition [...]

By |2022-12-11T19:44:49+00:00January 18th, 2011|Sharepoint on Premise|0 Comments
Go to Top