Wednesday, February 23, 2011

how to indicate the type of list definition?

I am working on list definition with the type id is 10001, my list is based on Calendar list.

But how can i indicate my list def is Events List or not?

Thanks for you helping!

Friday, February 18, 2011

Support discussion board list definition in VS2010 template

Visual Studio 2010 had supported List Definition  template to create the project automatically with fully the schema and define the structure of list. Unfonately, it has not supported for Dicussion Board list.

But you can download another template to upgrade your existed template and can use dicussion board list.

Download here

To use this package, please following this instruction:
  1.  Extract this pakage then copy all folders & files into: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache\CSharp\SharePoint\SharePoint14\1033\
  2.  Copy this compressed file into: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp\SharePoint\SharePoint14\1033
  3.  Please overwrite all files and folders as if request.
Good luck!

Monday, February 14, 2011

"Access denied. Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"

Contribute account can access and some actions on the page. I created a new page with inheritance from the default.master of SharePoint 2010.

I tested on SharePoint 2007 and as a result it works smoothly. But in SharePoint 2010, I got an error:

"Access denied. Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"

The trace log:

It took me some hours to find out the problem, event thought I run the debugging line by line but it thows the exception before reach the CreateChildControl method. I guest it happens from ASPX or MasterPage.

Here is the problem:

 Some resources of this MasterPage can not be accessed by Contributor account, so just remove them out. Hope this help you fix your issue.

Sunday, February 13, 2011

"Access denied" when using contributor account to access to content-type

When I was using the contributor account to check the content-type folder is "message" or "Dicussion", I got an error: "Access denied!"

My code:

if (ctype.ResourceFolder.Name == "Message")
     //do something

But nothing happened with owner account.

Yes, because contributor account can not access to ResourceFolder properties of content-type. ResourceFolder was inherited from SPFolder and execute the method FolderEnsure. You know to give the access to folder ensure the account must be set the properties currentWeb.AllowUnsafeUpdates = true; and the default for member account does not have permission to run that update.

You can change the code to look like this:

if (ctype.Id == SPBuiltInContentTypeId.Message)
    //do something

The result is nearly the same.