Archive

Archive for the ‘Uncategorized’ Category

Automating Office 365 with PowerShell

November 22, 2014 Leave a comment

For those of you attending CodeCamp tomorrow and just can’t wait to get your hands on those demos, here you are.  Enjoy!

Advertisements
Categories: Uncategorized

SharePoint Explorer view as a network drive (Windows 7/8x)

October 15, 2014 Leave a comment

Recently I was asked how to take the nifty SharePoint Explorer view and save a shortcut to it so users don’t need to constantly navigate to the library via the browser to access it.  This of course assumes that you do not want to or can not use OneDrive due to one of it’s many shortcomings.

  1. Ensure your site has been added to the “Trusted Sites” or “Intranet Sites” security zone in IE settings.  If it hasn’t been added, you’ll need to add it then reboot your computer.  If you don’t do this you’ll end up with an access denied error when you attempt to map the network drive.
    Screenshot - 10_21_2014 , 11_03_04 PM
  2. Navigate to the library in your browser and click the “Open with Explorer”.
    MapNetworkDrive-SharePointLib
  3. Depending on your operating system, you’ll need to do one of the following:

    Windows 8x only:

    1. In the explorer window tool bar click Easy access -> Map as Drive.
      MapNetworkDrive-MapDrive
    2. Wait for those slow Windows 7 people to catch up…

    Windows 7/8x:

    1. In the explorer window location bar, copy the location (from “http” to the very end).
      MapNetworkDrive-Win7CopyLocation
    2. Open My Computer from your desktop and select Map Network Drive.
      MapNetworkDrive-Win7MapNetworkDrive
    3. Paste the location we copied in step 2.1 into the folder text box.
      MapNetworkDrive-Win7PasteLocation
  4. In the Map Network Drive window, select the drive letter you wish to map to.
  5. For Office 365 users in the Map Network Drive window, check the box to Connect using different credentials.
    MapNetworkDrive-ChooseDrive
  6. Click Finish.
  7. If prompted, enter your SharePoint username/email and password and click OK.
    MapNetworkDrive-EnterCreds

[Edit – 11/22/2014] I found that this does not work well on Office 365, so if you’re using O365 and want a more permanent desktop integration solution, you’re stuck with OneDrive (until I can find a way to fix it).

Categories: Uncategorized

Date parsing and formatting in XSL

One task I’ve found to be the bane of my existence when dealing with XSL is date formatting.  There’s no a good way to do it, and it makes things extremely difficult always needing to write new XSL because no 2 dates ever have the same format.

Since I’ve written more than my share of date parsing templates, I decided that I would try to do it once more, and this would be the last time I’d ever write one.  The DateFormatting.xsl contains callable templates for most common operations.

Format Strings

The majority of the templates require a format string for input and/or output.  The syntax for the string is as follows:

m – the numeric value for the month i.e. 8, 9, or 10

mm – the 2 digit padded numeric value for the month i.e. 08, 09, or 10

mmm – the short month name i.e. Aug, Sept, or Oct

mmmm – the long month name i.e. August, September, or October

d – the numeric value for the date i.e. 89, or 10

dd – the 2 digit padded numeric value for the date i.e. 0809, or 10

yy – the 2 digit century i.e. 0809, or 10

yyy – the 4 digit century i.e. 2008, 2009, or 2010

ww – the short day of the week i.e. Sun, Mon, or Tue

www – the full name for the day of the week i.e. Sunday, Monday, or Tuesday

Any other characters are considered delimiters and are not evaluated as part of the date.

So the date 01-Jan-2011 would use the format “dd-mmm-yyy”

Templates

The templates are callable templates.  There are internal templates that begin with an underscore.  The main templates (with no underscore) are mostly wrappers around the internal templates and provide the ability to call the templates with strings instead of structured xml dates – I’ll explain the main ones below:

FormatDate – takes in a date string and returns a new date string in the specified format.  It accepts 3 parameters: inputFormatString, outputFormatString, & dateTimeString.  The inputFormatString specifies the format of the dateTimeString parameter.  The outputFormatString specifies the desired format of the returned date.  The dateTimeString contains the actual date to be formatted (pretty obvious I would think, but you never know).

Example:

.

.

.

Result:   20100130

ParseDate – parses a date and returns a new XML structure containing the raw date values.  Input params are the format string and the date string.

Ex:

.

.

.

Result:

.

.

.

CalculateDayOfWeek – parses a date and returns the numeric day of the week. Sunday = 1, Monday = 2, etc…

Ex:

.

.

.

Result:  4

** The rest of these follow a similar format and return a number or formatted string so I will not include the examples or results for the sake of brevity…

CalculateTotalDaysSinceEpoch – parses a date and returns the number of days since January 1, 0000.

CalculateTotalSecondsSinceEpoch – this method is somewhat pointless since the script does not take into account time – only dates.  So right now this just takes the DaysSinceEpoch and multiplies it by the seconds in a day.

MonthShortString – returns the short name of the provided month.  i.e. “Jan”, “Feb”…

MonthLongString – returns the full name of the provided month. i.e. “January”, “February”…

MonthFromShortName – returns the month number from the provided short name.

MonthFromLongName – returns the month number from the provided long name.

WeekDayLongName – returns the full name of the provided weekday number.

WeekDayShortName – returns the short name of the provided weekday number.

WeekDayFromLongName – returns the day number from the full weekday name.

WeekDayFromShortName – returns the day number from the short weekday name.

You can find the full XSL code along with a test stylesheet and some sample data here.

Categories: Uncategorized

SharePoint 2010 – Cannot complete this action. Please Try again.

February 11, 2011 Leave a comment

Recently while debugging a web part in SharePoint 2010, I received this error message.  I had never seen it before but after doing some searching, I found that apparently this happens quite a lot in SharePoint.

First thing I tried was to open the page in ?contents=1 mode and found the following:

Once the erroneous web parts were removed, I redeployed my solution and added my new webpart onto the page, but alas, still getting the same error.

So, I decided to take a closer look at my code, more specifically, the list I was deploying, and the code used to query it.  After more than a few hours of staring at the answer (and even almost giving up and putting a post for help on stackoverflow.com) I noticed this:

<Where>
  <FieldRef Name="Source" />
  <Value Type="Text">http://dev01:80/Pages/default.aspx</Value>
</Where>

Damn! Poor CAML syntax – the bane of my existance.  After changing the CAML so it was formatted properly:

<Where>
  <Eq>
    <FieldRef Name="Source" />
    <Value Type="Text">http://dev01:80/Pages/default.aspx</Value>
  </Eq>
</Where>

Everything started working as it should.  Why Microsoft decided to stick us with this crappy query language then provide us with no means of validating it and give us completely ambiguous errors and COM errors on top of it all (or below it all depending on how you look at it) just makes me question why I ever decided to use Microsoft products to begin with.

Categories: Uncategorized Tags: ,

The path specified cannot be used at this time. Exception from (HRESULT: 0x80070094)

November 8, 2010 2 comments

Recently, while attempting to deploy a new WSP file to my dev environment, I was presented with another exceptionally helpful error message:

Error: The path specified cannot be used at this time. Exception from (HRESULT: 0x80070094)

It took me a little bit to figure out, but basically, I reset the SP Timer service and all was well again.

What’s interesting is that even after getting this error, SharePoint claimed that the solution was properly deployed – though I didn’t want to take any chances with finding bugs due to a partially deployed solution.

Categories: Uncategorized

WritableBitmap finally usable, and very cool

I just found a very cool set of extension methods that actually make Silverlight’s WritableBitmap class usable.

The Codeplex project

It’s going to allow for a much faster particle generator as well as some other very cool effects.

Other links:

http://blogs.silverarcade.com/silverlight-games-101/15/silverlight-blitting-and-blending-with-silverlights-writeablebitmap/

http://kodierer.blogspot.com/2009/11/drawing-shapes-silverlight.html

Categories: Uncategorized