|
Oct
23
|
A really great article on MSDN in order to install SharePoint 2010 on Windows 7, and really explicit.
http://msdn.microsoft.com/en-us/library/ee554869%28office.14%29.aspx
|
Sep
02
|
Again a little tip concerning SharePoint and XSL.
Add the following snippet in the xsl file, for example one of your custom style in the itemstyle.xsl file.
<span class="presence-status-icon">
By: <a href="http://[MySharePoint]/sites/intranetbelgium/_layouts/userdisp.aspx?ID={$AuthorID}">
<xsl:value-of select="concat($AuthorName,’ ‘)" />
</a>
<img src="/_layouts/images/blank.gif" onload="IMNRC(’{$AuthorEmail}’)" alt="" id="{concat(’MWP_pawn_’,$ClientId,’_',@ID,’type=sip’)}" />
</span>
Tips: you can add "ShowOfflinePawn=1” before the add property in the img tag, this will show the offline picture of OCS if the “AuthorName” is offline. I personnally prefer to remove it, I found that cleaner.
|
Sep
01
|
The problem: Microsoft provide a way to create custom headers using the file Header.xsl but doesn’t provide the same kind of file concerning the footer. So how to create a style containing a footer and a header?
Inside your new style in the file itemstyle.xsl add the following snippet:
For a header add a test to check if there is a preceding sibling:
<xsl:if test="count(preceding-sibling::*)=0">
This is the header !
</xsl:if>
For a footer add a test to check if there is a following sibling:
<xsl:if test="count(following-sibling::*)=0">
This is the footer !
</xsl:if>
That’s pretty easy to do and I hope it can help.
|
Apr
14
|
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.
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.
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.
Have a nice day !
|
Apr
12
|
1: UserProfile u;
2: u[property].Value = "My string";
3: u.Commit();
1: SPSecurity.RunWithElevatedPrivileges(delegate()
2: {
3: using (SPSite site = new SPSite(web.Site.ID))
4: {
5: // your code
6: }
7: });
1: try
2: {
3: if (profileManager.UserExists("MOSS\\andy"))
4: {
5: //Do something
6: }
7: }
8: catch (UserNotFoundException ex)
9: {
10: //Do something
11: }