Archive for the ‘Libraries and Lists’ Category

Apr
14
Filed Under (Design, Development, Libraries and Lists) by Andy Diericks on 25-04-2007

Hi, today I will fully explain how to create a “custom action”. For it I will use “Visual studio” and WSPBuilder, you can find it on codeplex.

Our action will appear on the display page of all the items of a custom list. By clicking on it, the user will be redirected to google. A custom action has to be included in a feature, meaning, we will create a standard feature and add code in it to define that we want to create a custom action.

So now let’s get started, you will need to create a new WSPBuilder project (without workflow), when the new project is loaded, choose Add->WSPBuilder->Blank Feature. The system will ask you a name and to choose a scope, in my example the scope choosen is web (for website). If you have done a mistake about the name or the scope, that’ not a problem, you will be able to modify those directly in the XML files.

Now that you’ve created your new feature, you will have in the document explorer an hierarchy like the following picture.

image

Now you have all your structure done, here is the code to include.

The feature.xml file will contains all information about the feature (title, ID, scope,…), use the intellisense to check what is proposed. The important thing is the link to the manifest, in our case, “elements.xml”.

<?xml version="1.0" encoding="utf-8"?>
<Feature  Id="0FE81D03-6AE0-48a0-BBF7-88A1DAA9B04A"
          Title="Import UP"
          Description="Description for Import User Profiles"
          Version="12.0.0.0"
          Hidden="FALSE"
          Scope="Web"
          xmlns="http://schemas.microsoft.com/sharepoint/">
    <ElementManifests>
        <ElementManifest Location="elements.xml"/>
    </ElementManifests>
</Feature>

The elements.xml file define the content of the feature, in our case a custom action. To find the required fields refer to that MSDN link: CustomAction Element (Custom Action) . What is really interesting is the registrationtype, you can register to some different contents in our case the lists and the registrationID refers to the type of list (100=custom list) we want to add the action in. But you can choose a registration of type content type and give the name of it, so that action will be relevant only for that content type. An important thing is to define the location of the action, where it will appear. The URL define where the users will be redirected when clicking on it, it can be, and probably will be in the real life a custom ASPX page.

Refer to that MSDN link to find all the location and GroupID (in the comments too!):  Default Custom Action Locations and IDs

You will see the 2 first columns, location and GroupID, if the GroupID is not empty or not contains N/A, you will have to include it in your custom action element, an example is done at the end of the post.

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <CustomAction
        Id="CustomActionGetUerProfiles.CustomAction"
        Location="DisplayFormToolbar"
        Title="Import Users"
        RegistrationType="List"
        RegistrationId="100"
        Sequence="10"
         Description="The description" RequireSiteAdministrator="FALSE">
        <UrlAction Url="http://www.google.com"/>
    </CustomAction>
</Elements>

Now that you have your two files, your custom action is ready to be deployed, using WSPBuilder, simply choose, “Deploy”. Refresh the page and go to a custom list, if everything goes well when you will click on the view item button, on the next page, above, you will see our “Import user” action. By clicking on it you will be redirected to google.

image

image

If in the elements.xml you change the location to Location=”Microsoft.SharePoint.StandardMenu” and include GroupID=”ActionsMenu”, your action will be now on the toolbar of the list in the Action menu and the click will redirect you again to google.

image

Have a nice day !



Aug
06
Filed Under (Libraries and Lists, Reports, Sites) by Andy Diericks on 25-04-2007

The adventure of today is: Auditing Sharepoint!

Did you know that Sharepoint can generate audit reports ?

Ok for me those tools are more logging than auditing, but as the Sharepoint’s terminology call that Audit, I will call it like that.

From my point of view the contents of the reports are impressive FOR a out-of-box solution, maybe after learned the feature of those you will tell: “I know better tools for auditing an intranet”.

And you will be right, but your solution or tool will probably be more expensive than using the OOB tools because it will be from third parties or custom dev, but there will be maybe more accurate or provide a real analysis than just data.

So to make it short what does that auditing tool ?

You can generating reports at documents or item level, you can log:

  • Opening or downloading documents, viewing items in lists, or viewing item properties
  • Editing items
  • Checking out or checking in items
  • Moving or copying items to another location in the site
  • Deleting or restoring items

And list, libraries and sites you can log:

  • Editing content types and columns
  • Searching site content
  • Editing users and permissions

Now the important question is how can you use it ?

First you have to choose what to log, to do it, simply go into the “Site Settings” and in the column “Site Administration Collection” you will find the item “Configure Audit Settings”.

Here you can check everything you want.

Sharepoint Configure Audit Settings

Configure Audit Settings

After you will have all configured, you can check the reports, the big surprise is that they are generated in .xml, a very good point, because you can open it with exel and easily create charts, use pivot table and other funny things.

Here is the list of full proposed records.

View Auditing Reports

View Auditing Reports

You can in the screenshot, that you can customize more the settings of the auditing reports,  you can choose to log a specific list or site for example.

I’ve applying a log on the deletion action, uploaded some file in a doclib a deletem them, here is the generated reports about the deletion:

Deletion Report 1

Deletion Report 1

The first tab is an overview with only the count of deleted items and their location in the portal.

The second tab (Report Data), tell more details, like who has deleted the docs and when, which is more useful to trace what really happen on the portal.

Deletion Report 2

Deletion Report 2

Hope you have found that post interesting.



Aug
04
Filed Under (Libraries and Lists, Sites) by Andy Diericks on 25-04-2007

Something that everybody involved in content migration must know.

Because you think, ok I will upload 1000 files easily with the “Explorer View”, but back to reality when you see that you have a “&” in almost every filename and you will have to rename those ;-)

And of course when you are working for a big company like a bank, you cannot rename files without approval, and it will really slowly the process.

Extract from: http://blogs.officezealot.com/legault/archive/2007/04/26/20302.aspx

Site Names

· In WSS Site Names may not contain the following characters: \ / : * ? ” < > | # { } % & <TAB>” ~ +

· You cannot start a site name, subsite name, or a site group name with an underscore (_) character or with the period character (I recommend avoiding the (_) underscore in site names)

· You cannot use the period character consecutively in the middle of a site name

· You cannot use the period character at the end of a site name

File Names

· Invalid characters: ” # % & * : < > ? \ / { | } ~ 

· Cannot be longer than 128 characters

· You cannot use the period character consecutively in the middle of a file name

· You cannot use the period character at the end of a file name

· You cannot start a file name with the period character

Folder Names

· You cannot use the following characters anywhere in a folder name or a server name: ~ # % & * { } \ : < > ? / | ”

· Cannot be longer than 128 characters

· You cannot use the period character consecutively in the middle of a folder name

· You cannot use the period character at the end of a folder name

· You cannot start a folder name with the period character

Hope it will be useful for you. ;-)



Aug
03
Filed Under (Content Type, Libraries and Lists) by Andy Diericks on 25-04-2007

In Sharepoint, content types are the “BIG” thing.

Here is a small answer to a questions that every new site administrator or new end user will have one day.

When you want to add a page or a document in a library, you are doing: “New” -> and you choose a “type of item”, in Sharepoint the type of item is a “Content type”.

To add a content type in the list, you need to go to the library settings and add it to the list of used content type.

To do it:
You need first to allow content type management for the library.

-Go to the “site actions” -> “View all site content”
-Choose your library where you want to apply the content type
-Go to “Settings” -> “Document library settings” -> “Advanced Settings”
-And click on “Yes” below “Allow management of content types?”, validate by clicking OK

Now we can a content type to be used by the list.
-Go to the “site actions” -> “View all site content”
-Choose your library where you want to apply the content type
-Go to “Settings” -> “Document library settings”
-In the middle of the page you will have a content type list (if no, check below)
-Choose “Add from existing site content types”
-And now you will see a screen with a listing of all content types you can use, choose the one you’re interested in and click “Add” -> ok to validate the change.

Now you will be able to choose the content type you need in the list.  8-)