Welcome to MSDN Blogs Sign in | Join | Help

Yep, had to figure this out since I'm still working with SharePoint stuff.  I couldn't find any "HowTo's," code samples, tricks, hints, or anything else really helpful on this.  Just a bunch of other folks attemptint to do the same thing.

 This is one of those things where the answer looks simple and seems like it should have been apparent from the start.  Alas I couldn't see it in the beginning either.

 Here's the magic code:

// get a reference to the folder (this assumes path points to a valid folder)

SPFolder folder = SharePointConfiguration.Site.GetFolder(path);

 

// get a reference to the Sharepoint group collection

SPGroupCollection spc = SharePointConfiguration.Site.SiteGroups;

 

// get a reference to the group who’s permissions you want to modify for the folder above

SPGroup group = spc[groupName];

 

// create a role assignment from the group reference

SPRoleAssignment roleAssignment = new SPRoleAssignment((SPPrincipal)group);

 

// break role inheritance for folders/files because they will be having permissions separate from their parent file/folder

folder.Item.BreakRoleInheritance(true);

 

// update the role assignments for the group by adding the permissionSet “TestPermissionLevel” which is a custom

// permissionset I created manually…you can easily use any of the built-in permission sets

roleAssignment.RoleDefinitionBindings.Add(SharePointConfiguration.Site.RoleDefinitions["Test Permission Level"]);

 

// apply the new roleassignment to the folder.  You can do this at the listitem level if desired (i.e. this could be SPfile.Item…. instead of SPFolder.Item)

folder.Item.RoleAssignments.Add(roleAssignment);

1 Comments
Filed under: ,

You may encounter the following error if you are trying to build a ASP.NET application or web service on a x64bit machine where Sharepoint is installed:

Error 1 Could not load file or assembly 'Microsoft.SharePoint.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified. C:\Documents and Settings\robgruen\My Documents\Visual Studio 2005\WebSites\MyWebService\Web.Config

What happens is that the ASP.NET compiler is a 32bit process and tries to load 32 bit assemblies.  Since you're on a 64 bit box and the Sharepoint install NGENs it's asseblies, there are only 64 bit assemblies available.  This causes the compiler to not load the referenced assemblies (Microsoft.Sharepoint.*.dll) and causes the error shown even though the assemblies are in the GAC, bin folder, etc. 

You can fix this problem by placing 32bit versions of the referenced assemblies in the bin folder of your web application.  Unfortunately IL versions of the Sharepoint dlls do not ship with the Sharepoint SDK so you'll have to find a 32 bit install of Sharepoint where you can grab the dlls from.

So I get my third dual head card in the mail the other day and after two days of patient waiting I took the plunge to install it.  Well, to make a long story shorter, it took me all day to get working.  Typically you just add the video cards and voila, things work without a hitch, well, not this time. 

 What I thought was going to be an easy thing was definitely not.  Putting the video card in and installing the drivers went fine but when I went to the display properties settings dialog I got a very bogus error message:

 

The currently selected graphics display driver cannot be used. It was written for a previous version of Windows NT, and is no longer compatible with the current version of Windows NT.

The system has been started using the default VGA driver.

Please contact your hardware manufacture to get an upgraded driver, or select one of the Microsoft provided drivers.

 

Well, I know this error message is bogus because the video card works by itself in the system and the drivers are WHQL certified.  When I opened up the device manager it stated "this device is working properly." So I know the error was just hiding the true cause of the problem. 

 I started playing all the tricks I know with the video card, swapping the PCI bus order, changing PCI/PCIe slots to initalize 1st, nothing worked.  What worked was any two combinations of the video cards (they are all heterogenous manufacturers & drivers), but never all three at once. 

 I finally came across the holy grail of my problem when reading display driver documentation.  It turns out that display adapters are given a certain slice of memory to load in and if the total size of the drivers exceeds this allotment the driver won't load.  Hence why two cards always worked but the third card always failed.  You can set a registry key to change the default memory footprint and increase it such that you have enough space for the drivers to load.  I first change the value to 16MB, which should be enough for most folks having this problem, and then subsequently to 32MB before I was able to run all six displays on my machine without a hitch.

 So, if you are getting the above error message when going to the settings tab of your machine and have multiple video drivers installed and have already tried Q165318, set the following registry value (please make sure your system's backed up before you play with this registry setting):

 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\SessionImageSize

 DWORD 0x10

 

5 Comments
Filed under:

To install the MouseWheelFix on a 64 bit edition of Windows you need to place the registry key entries in the 32 bit node of the registry.  This means the registry keys should be HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft... instead of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft...

 

As usual, happy scrolling!

Simple, YOU CAN'T!!!

For a while now my computer's Automatic Updates has been broken.  No new downloads have appeared, the control panel icon is missing, and the Windows Update site can't install the updated ActiveX control.  Every time I go to the site it tries to update the WU client and I keep getting this 0x800703E3 funky error code.

Windows Update Codes - My error is pretty cryptic: "The I/O operation has been aborted because of either a thread exit or an application request"

I tried once already to fix it a while back but no luck so I just lived without it.  Well, now I can't access certain resources since some security policies that I'm subject too aren't installed on my box. 

...Darn, I should have fixed the WU problem when I had the chance.  Being stuck in IT limbo isn't fun! I didn't want to waste more of my time or some support engineer's time so I resigned myself to fix my own problem.  Go me!

I whipped out my Swiss Army IT-Problem-Solver and selected the FileMon tool.  Clearly visible to me were the marks from the last problem conqured by this device, in the include filter I could see "de*.exe"

I quickly configured the tool for this operation by setting the filter to "iexplore.exe" and turned on the capture.  Then, I navigated the browser to http://windowsupdate.microsoft.com and waited impatiently for the ugly beast to appear.  "There!" I whispered then snickered as I switched back to filemon and stopped the capture.  I swiftly began searching for anything out of the ordinary.  I was expecting to see some ACC_DENIED or FILE NOT FOUND errors but nothing.  There appeared to be no suspicious entries until about half way up the log...at row 9087 I saw it, my first real clue:  DEVICE DATA ERROR, and another ar row 9084:  IN PAGE ERROR.

"Hmmmm..." I thought as I looked at the file name: c:\windows\system32\wuaucpl.cpl.  Immediately I was able to recall what I know and what I could infer about this file:

  1. The "WU" portion of the file most likely stands for "Windows Update".  I quick check on the dll help database could verify it for sure but I skipped that.
  2. The extension CPL is used for control panel icons.  These files are actually executables with just a different extension.

Given these facts I browsed to the file with windows explorer and tried to launch the exe (wuaucpl.cpl).  When I launched it I got an error:  "Failed to launch executable due to an exception" or something along those lines.  I didn't write the error message down because I was on to something and wasn't thinking clearly.  Sorry for all you Googler's, et. al. out there. 

This was my smoking gun, a bad file (or bad sector on the disk where this file got put last time I defragged).  All I had to do was replace the file with a good image of it.  If I were smart, and I'm not, I would have done a restore point when I first got this error.  That would have easily restored the file to it's original shine.  Unfortunately, again since I'm not smart, that restore point is so far gone not even a terrabyte worth of restore points could have kept track of it. Well, maybe 1 TB, but certainly not 1 GB worth!

Luckily I'm a computer nerd and had a secondary computer around where I could just copy this file.  Thankfully the donor computer was of a similar breed and the file name, timestamp, and all the other things Windows File Protection cares about was the same so I could just overwrite the existing file and be on my way.

Here I sit writing this entry as my computer happy checks for updates and downloads the...hold on a sec while I check....127.7MB of updates needed for my computer.  I'm sure there will be a second, if not third batch by the time all of the updates are applied.

So kids, what is the moral of the story?  If you're getting error number 0x800703E3 when visiting windows update, use filemon to see what file the update is failing on.

Happy updating ever after!

 

 

 

 

 

7 Comments
Filed under:

The Sandbox here at Mix contains all sorts of labs, vista pcs, windows media center, and of course the awesome ultra mobile pcs.  :) I got to play with the devices and talk to Lora who was tending the devices and answering questions.  Unfortunatley I had to share her time and the time of device as there are lots of people wanting to play with them.

 

Here are my thoughts on the devices so far (I've had about 30 minutes total on them):

 

  • Of the devices so far the Founder device is my favorite.  It's lightweight, has great ergonomics, and is lightning fast.
  • They were all prototype devices so there is some work left to be done.
  • The Asus did show some wear on the buttons (the coloroing was worn off) but it was at CeBIT in Germany so I'm sure thousands of people have touched the device.  To me that means that'll hold up well.
  • The key typing glyphs are hard to get used to but I think will be quite usable once you get the hang of it.
  • The Samsung had a vent for the cpu fan right under the left hand which was not very comfortable and doesn't encourage lengthy use of the device since your hand will definitley start sweating.  They should probably invert the CPU and put vents on the back of the device, or along the top edge, instead of along the side.
  • The touch screen often goes forgotten as I kept wanting to use the stylus but I guess that's because I'm not used to having the luxury of a touch screen.
  • I'm left handed so trying to use windows journal or one note was tough because of the touch screen...I had to keep my hand off of the display otherwise I'd freek the cursor out when the side of my hand touched the display surface.
  • There are products you can use to connect the device to a larger display.

To sum it all up:  :) Bye bye laptop!

0 Comments
Filed under:

We were fed quite well, thanks to all of the folks that made the food decisions.  My tummy is happy!

The keynote was pretty cool, Tim O'Reilly's interview with BillG went really well.  Bill had great answers and everyone was happy with his responses.  I'm sure others will blog about it in more detail than myself. 

I'm having to use one of the terminals set up here to blog since my lappy is in the hotel room. 

0 Comments
Filed under:

MIX06 is sold out!  1900 attendees have come to Vegas to talk about the future of their respective portions of the internet.  In fact, I think it's already started since I heard some conversations on the flight in.  The check-in area has about a dozen lanes, looks like we were smart to check in tonight instead of early in the morning.

Since I'm registered as an "attendee" I got a bag of gifts including VS.NET 2005 standard edition, that'll be a nice gift to one of my buddies.  There's also a notebook (yes, paper for hand written notes) and various other items.

Should be a grand day tomorrow!

 

1 Comments
Filed under:

Well, I just stepped off of a 5.5 hour flight got a rental car for 16 hours and then I'm back on another flight to Las Vegas all within a 24 hour time span.

More to follow!

0 Comments
Filed under:

A VERY large thank you goes out to Kevin Willimason for taking the time to hook (no pun intended) us all up.  Kevin rewrote a majority of the add-in so it works in SDI mode.

We are in the process of getting the KB article udpated.  In the mean time you can grab the updated source and binaries from this post.

 

Happy Scrolling!!

0 Comments

Attachment(s): MouseWheelFix.zip

I was trying to install a web service on a freshly build W2k3 box.  I checked the event log and found:

Event code: 3005

Event message: An unhandled exception has occurred.

Event time: 1/3/2006 12:50:03 PM

Event time (UTC): 1/3/2006 8:50:03 PM

Event ID: e85fe2d9c6c84f9287d5bed943869d42

Event sequence: 1

Event occurrence: 1

Event detail code: 0

Application information:

Application domain: /LM/w3svc/1/ROOT/DirectoryLookup-7-127807950038139240

Trust level:

Application Virtual Path: /DirectoryLookup

Application Path: c:\Inetpub\wwwroot\DirectoryLookup\DirectoryLookup\

Machine name: localhost

Process information:

Process ID: 2244

Process name: w3wp.exe

Account name: NT AUTHORITY\NETWORK SERVICE

Exception information:

Exception type: HttpException

Exception message: The current identity (NT AUTHORITY\NETWORK SERVICE) does not have write access to 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files'.

Request information:

Request URL: http://localhost/DirectoryLookup/DirectoryLookup.asmx

Request path: /DirectoryLookup/DirectoryLookup.asmx

User host address: 127.0.0.1

User:

Is authenticated: False

Authentication Type:

Thread account name: NT AUTHORITY\NETWORK SERVICE

Thread information:

Thread ID: 1

Thread account name: NT AUTHORITY\NETWORK SERVICE

Is impersonating: False

Stack trace: at System.Web.HttpRuntime.SetUpCodegenDirectory(CompilationSection compilationSection)

at System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags)

Custom event details:

For more information, see Help and Support Center at

 

Adding permissions to the folder specified in the error fixed the problem.  HTH someone else out there.

 

1 Comments
Filed under:

Well, the main project I was working on suffered a minor setback when the HDD on the box died.  Until that get's settled I get to work with a smartphone on a cool little project.  Unfortunately the smartphone also had it in for me. :)  I got the following error:

Error 1 The device security configuration disallowed the connection. Ensure that you have the appropriate certificates on your device for development. Review your SDK documentation for proper security settings for connecting to this device. Device Connectivity Component 

This error was quickly suppressed by doing the solution found here:  http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=23899&SiteID=1.  (I reinstalled vs_emulator.exe instead of going to the download site).

I figured I'd mention all of this since I've been finding the "Answer" feature of the forums really really nice.  It's saved me a lot of time reading through all of the posts.  Props to whoever is responsible for putting that feature together.

Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.42
Copyright (C) Microsoft Corporation 1998-2004.  All rights reserved.

RegAsm : error RA0000 : Could not load file or assembly 'MyAssembly, Version=0.0.
0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Exception
 from HRESULT: 0xE0434F4D

Now I know my assembly has version 1.0.0.0 so this doesn't make sense....nor did the fact that using fuslogvw didn't show any assembly binding failures and filemon showed that the file is being located and read from without any problems.  Well, now what?  Create a simple .NET project (doesn't matter what), and set the debugging options to launch an external program (c:\windows\microsoft.net\framework\v2.0.50727\regasm.exe) and set the command line arguments to pass in the dll you're trying to register.  Also configure the debugger to break when excpetions are thrown.

Run the project and the IDE will break on the underlying exception that's causing the whole thing to bust.  In my case it was this exception:

      DLL 'MyAssembly.dllis attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.

1 Comments
Filed under:

So I was upgrading a project from VS.NET 2003 to VS.NET 2005 (v2.0 of the framework) and I kept hitting this assert:  "_CrtIsValidHeapPointer(pUserData)."  There were several postings out and about but they were all for previous versions of the framework, nothing to do with upgrading to whidbey.  After a long and unsuccessfull jaunt to change my C++ syntax from /clr:oldsyntax to just /clr along with many other now forgotten changes, I made the following project change:

I changed the code generation property of "runtime library" from /MDd to /MD...and voila, gone!  Hopefully this tidbit will save someone an afternoons worth of work!

Now I get to go stand in line at BestBuy this weekend and hopefully acquire a XBOX 360. [:D]

The VS.NET SDK (a.k.a. VSIP package) lacks the wide spread use and documentation that other SDKs enjoy.  To make a change to that here's a little snippet that shows you how to open the VS.NET webbrowser and browse to a particular page:

 

IVsWebBrowsingService web = (IVsWebBrowsingService)Vsip.VsPackage.VsPackage.GetGlobalService(typeof(IVsWebBrowsingService));

if (web == null)

   return;

IVsWebBrowser ppBrowser;

IVsWebBrowserUser pUser = (IVsWebBrowserUser)Vsip.VsPackage.VsPackage.GetGlobalService(typeof(IVsWebBrowserUser));

IVsWindowFrame ppFrame;

Guid g = new Guid();

g = Vsip.VsPackage.GuidList.guidToolWindowPersistance;

uint flags = (uint)(__VSCREATEWEBBROWSER.VSCWB_ForceNew | __VSCREATEWEBBROWSER.VSCWB_AutoShow);

web.Navigate(URL, flags, out ppFrame);

More Posts Next page »
 
Page view tracker