Sharepoint 2007: 'Only their own' permission on Document Library

In Sharepoint 2007 you have a great permission you can set: ‘Only their own’. This allows someone to view and edit only the items that they have created, and not other items that other people have created. Administrators of the site can see everything, of course.

This is easy to set on a List under the list settings. However, if you are using a Document Library, the setting is nowhere to be found. It is there, but it’s hidden.

To change this setting, you can either write some code, as described here, or you can do the equivalent with Sharepoint Manager (make sure you get the 2007 version). Open Sharepoint Manager (while logged into your Sharepoint Server), drill down to the Document Library you are interested in, and you should see the ‘WriteSecurity’ setting. Change it to 2 to effectively set it to ‘only their own.’

However, keep in mind that this only changes what the user can do via the UI. If they get to the list data via web services or some other method, this won’t prevent them from getting at other people’s data.

Passing a table using Nav Automation

I just had someone comment on my previous blog post asking how to pass a table using Nav Automation. Great question.

You can pass complex objects using Nav Automation, but only ones that you define (or that have been explicitly written to work with COM). This means that you can’t pass a DataTable object, but you can create your own implementation of a DataTable object and pass it.

In your complex object, you have to explicitly define every property and method that you need to call on that complex object and surface those properties and methods through COM.

Read More

x does not contain a definition for y

I just ran across this problem… again… and because I didn’t note the solution last time I had to figure it out again. It’s so simple - but so hard to remember. Let’s hope that next time I hit this I’ll at least remember that I blogged about it. Here we go.

I’m building a web site, and it makes use of some DLLs that come from some C# libraries I’ve built. Over the course of time, I’ve added some functions to the libraries that I use in my website. And the website picks up the new functions and everything is great.

Then one day I come along and try to build the website in Visual Studio, but it gives me an error because it says that one of the newer functions in my library is missing. Here’s the error:

className does not contain a definition for functionName
Hmm. I check the other project (which lives in the same solution), and the function is there. So I go to my web control, which is generating the error, I right click on the function name, and click ‘Go to Definition’, and sure enough, it jumps right to the function.

After a couple of hours of removing pieces and parts from different projects and trying to narrow things down, all without any avail, a thought finally hits my brain. The GAC!

Sure enough, an older version of my library somehow ended up in the GAC. I removed it from the GAC, then everything built just fine.

FYI, to remove a library from the GAC, browse in windows explorer to c:\windows\assembly, right click on the dll you want to remove, and click ‘uninstall.’

Linq causes the Setup project to fail when building

All of a sudden, my setup project stopped building. It was very strange - when I tried to build it, it would say that the build failed, but it gave no errors. Nothing anywhere.

Thankfully, I’m not the first person to have run across this. It turns out that adding Linq to one of the projects in my solution caused this failure - it appears to be a bug in Visual Studio.

The solution appears at Microsoft’s Connect site (be sure to look in the ‘Workarounds’ tab) - https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=317870

Here is what Daren wrote:

1. Close VS 2008.
2. Open the project file containing the LINQ To SQL item in Notepad.
3. Remove the following lines:

1
2
3
<ItemGroup>
<Service Include=”{3259AA49-8AA1-44D3-9025-A0B520596A8C}” />
</ItemGroup>

The Setup Project will now build successfully. However, if you double-click the DBML file to open the designer in VS 2008 the Setup Project will stop building again. The above lines do not get re-added to the project file but the Setup Project will stop building anyway. Just restart VS 2008 and it will work again – until you open the DBML designer again. Once the Setup Project fails due to this problem it will never build successfully until after you restart VS 2008.

OOO, C#, and C/AL

I’ve been working with building some web services built on the Microsoft Dynamics Nav 2009 web services platform. Microsoft is doing something fairly slick here - you write code in the C/AL language, save it as a Nav Object, expose it as a web service, and the web services layer automatically translates the C/AL to C# and runs it in .Net. This allows you to debug the code using visual studio, among other things.

But it’s not perfect. Sometimes it makes mistakes.

I had this line of code in C/AL

1
IF AVSetup.”Sub Award Dimension No.” - 1 IN [1..8] THEN BEGIN

Which auto-translated to this in C#:

if(aVSetup.Target.GetFieldValueSafe(90, NavType.Integer)
  .ToInt32()-(1 >= 1 && 1

Oops. The order of operations got mixed up. The C/AL code subtracts one, then sees if the value is between 1 and 8. The C# sees if 1 is between 1 and 8 (getting a boolean value) and then tries to subtract the boolean value from the number. C# then gives this error:

Operator ‘-‘ cannot be applied to operands of type ‘int’ and ‘bool’

Thankfully, the solution for this is simple. All you have to do is use extra parentheses to explicitly set the Order of Operations.

1
IF ((AVSetup.”Sub Award Dimension No.” - 1) IN [1..8]) THEN BEGIN

SQL Reporting Services, Sharepoint, and Firefox

I ran into a problem when I tried to use Firefox to view a SQL report on Sharepoint. In IE it works fine, but when it hits firefox, a ‘display: block-inline’ CSS style set on a table buried way down in the code caused firefox to do this:


The report is squeezed into a little IFrame, and you don’t even get a vertical scrollbar. Sure, you can right-click on it and get your browser to show that IFrame as the main page, but that’s not a good solution for end users. So I set about trying to figure out how to take care of this.

I found all kinds of helpful information about the problem. Lots of people had solutions, but none of them worked for me. Here is some of what I found:

Read More