Tadi malam ngobrol ama client dan ada request untuk tidak bisa menghapus document yang di buat tetapi user tersebut punya hak akses untuk create document / upload document.
Daripada pikir panjang untuk menghapus link delete item di context menunya akhirnya saya langsung memberikan solusi bila user tersebut delete item tersebut akan di berikan notifikasi "You don't have authorized to delete this item".
Setelah client setuju akhirnya saya membuat event dan coding untuk handle event tersebut.
Coding sbb :
using System;
using System.Security.Permissions;
using System.Runtime.InteropServices;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;
using System.Diagnostics;
using System.IO;
using System.Configuration;
namespace Agusto.Dms.SpEvent
{
[CLSCompliant(false)]
public class MyItemEvent : SPItemEventReceiver
{
private SPWeb spWeb = null;
/// <summary>
/// Initializes a new instance of the Microsoft.SharePoint.SPItemEventReceiver class.
/// </summary>
public MyItemEvent ()
{
}
/// <summary>
/// Synchronous before event that occurs before an existing item is completely deleted.
/// </summary>
/// <param name="properties">
/// A Microsoft.SharePoint.SPItemEventProperties object that represents properties of the event handler.
/// </param>
[SharePointPermission(SecurityAction.LinkDemand, ObjectModel = true)]
public override void ItemDeleting(SPItemEventProperties properties)
{
string LoginName = properties.UserLoginName;
if (!LoginName.ToLower().Equals(@"sharepoint\system"))
{
try
{
using (spWeb = new SPSite(properties.SiteId).OpenWeb())
{
SPUser user = spWeb.Users[LoginName];
if (!user.IsSiteAdmin)
{
properties.ErrorMessage = @"You don't have authorized to delete this item";
properties.Cancel = true;
}
}
}
catch (Exception ex)
{
properties.ErrorMessage = ex.Message + "," + ex.Source;
properties.Cancel = true;
}
}
}
}
}
}
Dengan code ini akhirnya user yang punya hak akses read/contributor tidak bisa delete item, tetapi system account dan account yang di set sebagi full control dari site akan bisa hapus item tersebut.
This is a good article how about to create a new workflow on moss/wss. For detail this info you can click this link http://aaronweiker.com/post/2008/03/Hello-World!-from-SharePoint-and-Windows-Workflow.aspx
This section provides code snippets that show general SharePoint centric code, such as that used in webparts or applications that tap into the object model (22 Snippets)
Access SharePoint User Information - This piece of code shows you how to access the current SharePoint Users information.
Create SharePoint Query - This is a small piece of code that shows you how to create a SharePoint query.
Creating A WebPart Menu Item - This snippet demonstrates a method that will allow you to specify a link in the webpart menu box (the context menu that you get with webparts). It is helpful when creating custom menu items for webparts, although appears to be deprecated in 3.0.
Determine If List Column Exists - This method is helpful if you need to determine whether a column in a list exists or not by passing in the column name as a string value. It is a helpful method when working with SharePoint field existence.
Determine if there are files and folders - This example shows you how to determine whether there are files or folders in a SharePoint asset. This is an asset existence method and can be used to prevent the overriding of other content.
Display A Users Role Collection - This snippet shows you how to display a particular users set of roles based on the user name parameter.
Display Site Collection Information - This method shows you how you can in a webpart display various pieces of information about a SharePoint site collection.
Example XSL Transformation - If you have an XSL document that you wish to apply to you webpart returns, you need a method to apply the XSL transformation.
Get a SharePoint Field By Its Name - This piece of code demonstrates how you could return a SharePoint field by passing in the name parameter.
Get A SharePoint List - This is a simple method that will add you in getting a SharePoint list from a site.
Get A Web Based On List Existence - This code sample demonstrates how to get a specific web based on a SharePoint list, returning the specific web. It also includes several layers of exception handling and various properties that can be set.
Get An XSL Filepath For WebParts - This method allows you to get an XSL File Path that you can use in your webparts. I find it useful if I am applying formatting to things that are generated out of the object model.
Get List View Items - This code sample provides method that will get the list items that are present in a SharePoint view.
Get the WebPart Qualifier - This method gets the webpart qualifier.
Getting A SharePoint Site Name - This piece of code shows you how to retrieve a SharePoint Site name after using the OpenWeb() method.
Insert Values Into The URL - This method will help you when you need to insert parameters into the URL string.
Load Lists Into Drop Down Control - This example shows how you could load all the lists in a web into a drop down control, for use in a toolpane or otherwise.
Open Up A Web Conditionally - This method shows you how you can open up a web conditionally based on pre-existing text, such as whether it exists in a text box in this specific example.
Progamatically Move List - This example shows you how to move a list within an arbitrary number of webs in SharePoint.
Redirect Users To Sites - This code snippet will allow you to redirect users to various sites based on their login.
Return Boolean If Flat Folder Structure - This example shows you how to return a boolean value if there is a flat folder structure present.
Show Whether A SharePoint Field Contains Metainformation - This is a small code sample that will show you how to determine whether a SharePoint field contains meta information.
for detail more snipset you can et on this link http://weblogs.mysharepoint.de/mgreth/archive/2007/05/02/sharepoint-code-snippets.aspx
SDKs and development tools
Revised and updated August 2007. The official SDK contains code samples references, and an Enterprise Content Management (ECM) starter kit. Also check the online version of the SDK that has community content (revised December 2007): http://msdn2.microsoft.com/en-us/library/ms550992.aspx |
Revised and updated August 2007. From Microsoft: The Windows SharePoint Services 3.0 software development kit (SDK) contains conceptual overviews, programming tasks, samples, and references to guide you in developing solutions based on Microsoft Windows SharePoint Services 3.0. The online version is available here (revised December 2007): http://msdn2.microsoft.com/en-us/library/ms441339.aspx |
(Visual Studio 2005 extensions for Windows SharePoint Services 3.0, Version 1.1) Visual Studio 2005 templates for list definitions, site definitions, web parts, list instance, list event handler, solution package editing. A user guide is also available for download. |
|
Description from Microsoft: Compatible with the released versions of the 2007 Microsoft Office system, Microsoft Windows Vista, and the .NET Framework 3.0 Runtime Components Provides developers with support for building workflow-enabled applications using Windows Workflow Foundation. If you are developing workflows for SharePoint in Visual Studio 2005 your will need this download as well as the WSS SDK (see above) which contains the Visual Studio 2005 template specific for SharePoint workflows. Update Visual Studio 2008: Visual Studio now contains the project templates and designer to create SharePoint Workflows, all integrated out of the box. |
Development helpers and add-ins for WSS and MOSS 2007
A free tool for eased installation and deployment of SharePoint 2007 solution files (wsp) to a SharePoint server farm. Provided by Lars Fastrup from Mondosoft. Update: the source code has been released and can be download via CodePlex: http://www.codeplex.com/sharepointinstaller. |
|
CodePlex project that delivers Visual Studio 2005 projet template(s) that help you build solution and cabinet files and finally a .wsp file. There is one template available at this time but it is planned to have others in the future. Check back at the CodePlex URL above. I personally used this template to start learning about solution files and building the .wsp file. It is not yet a completely automated process but should get you nicely on the way. It uses post build events that call .VBS files to create the manifest.xml and cabinet ddf file. |
CodePlex project that delivers Visual Studio 2005 projet template(s) to facilitate Workflow development with ASPX forms. This project aims to provide you with RAD-tools for creating workflows in Microsoft Visual Studio 2005. The current installment contains templates for three types of ASP.NET workflow forms; the association form, the instantiation form and task forms. This will later be augmented with wizard based form creation to allow the feature definition, and task content types to be auto generated. Tool by Wouter van Vugt |
|
A SharePoint Solution Package (WSP) creation tool for WSS 3.0 & MOSS 2007 This command line utility builds the cabinet ddf file, the manifest.xml and the .wsp file based on a folder structure that corresponds to the 12 hive. WSPBuilder Extensions ver. 1.0.0 now has: - Visual Studio Add-in. - Visual Studio Project and Item templates. - MSI Install package. - Supports Visual Studio 2005 and 2008. |
|
The SmartTemplates for SharePoint project delivers a collection of Visual Studio templates which allow developers to create a range of SharePoint customizations in a painless and professional fashion: write the web part code; generate a SharePoint Solution file (WSP) for easy deployment; generate a setup package for a wizard driven installation Another project by Jan Tielens, already famous with the creation of the SmartPart (see below).
|
|
This System Tray utility shows you all the application pools for your IIS and allows you to recycle them via the click of a button. No need for an IISRESET or going to the IIS management console anymore. This tool can be downloaded on Spencer Harbar's site.
|
|
This tool by Chris O'Brien helps you export sites, lists, etc using .cmp files (Content Migration Package). It allows you to select content to export via a treeview and import functionality by running the tool on the destination server. Currently in beta but worth checking out!
|
|
The SharePoint web part which can host any ASP.NET web user control. Create your web parts without writing code! Supports ASP.NET Ajax.
|
|
STSDEV is a proof-of-concept utility application which demonstrates how to generate Visual Studio project files and solution files to facilitate the development and deployment of templates and components for the SharePoint 2007 platform including Windows SharePoint Services 3.0 (WSS) and Microsoft Office SharePoint Server 2007 (MOSS). Note that the current version of the stsdev utility only supports creating projects with the C# programming language.
|
Tools for WSS and MOSS 2007 (object browsers, CAML tools)
|
A WSS3 and SharePoint object model explorer and management tool developed by Carsten Keutmann.
|
|
Description from the download site: You can see objects composing its structure, get their properties by reflection, which can be very useful when you want to check if your code does what it should do. You can use also some advanced features like activate/deactivate SharePoint features, add/remove event receivers, manage your recycle bin.
|
Another tool made available by Mondosoft. This tool was originally available for SharePoint 2003, this version is a recompile that does not yet offer any access to new functionalities like features and event handlers. This will become available later according to Lars :-) |
|
A free feature by Karine at U2U that helps you build, test and execute your CAML Queries (Collaborative Application Markup Language). Install as a custom action to build a CAML query via the interface and saves the query to a document library. The query is then available for use in your custom developments. Available also as a tool for SharePoint 2003. |
|
A browser for SharePoint 2007 that returns the CAML for lists and views. Copy the CAML from lists and queries and use it directly in your code. Great helper tool.
|
|
This tool allows you to use a point and click interface to gather information such as search scopes and properties, type in search terms, and click a button to create both the search SQL syntax as well as the Xml document that is needed to run a query against MOSS. You can see results in plain text, structured Xml and now a dataset view. It supports FREETEXT and CONTAINS as well as wildcard searching. A very valuable tool for those trying to write custom SharePoint queries.
|
|
A must have tool if you need to dig into parts of the WSS and MOSS classes. Reflector contains a decompiler, member and type search, XML documentation support. Reflector allows to easily view, navigate, search, decompile and analyze .NET assemblies in C#, Visual Basic and IL. |
|
SUSHI is a powerful, user-friendly SharePoint application enabling you to accomplish common SharePoint administrative and development tasks. You can think of SUSHI as a Swiss army knife for SharePoint. What does the name SUSHI stand for? SUSHI = SharePoint Utility with a Smart, Helpful Interface Functionalities include: Copy a view from one SharePoint list to another; View all sites and lists a user has access to; Backup a site; Restore a site; Bulk site creation; and more. |
This project contains a complete deployable solution that allows you to manage custom event handlers in SharePoint Server 2007. The project includes the various various visual studio projects required to build and deploy such a solution. See also a complete article series about event handlers by Brian Wilson: blog series. |
Can't wait for the release of Visual Studio 2008 and start using LINQ? What about using LINQ queries for SharePoint? Bart De Smet is working on a tool for using LINQ with SharePoint. Looks promising! Currently in alpha. See also the team blog: http://community.bartdesmet.net/blogs/LINQtoSharePoint/. |
|
A command line tool that helps administrators to import user profile information into MOSS 2007. Create an XML file with the informaiton and the tool will import the user information into the MOSS profile properties. Another tool on CodePlex.
|
|
Contributions from several Microsoft teams and MVPs to deliver useful tools and add-ons for SharePoint. At the time of writing two tools are available: - CopyTimer: A tool for measuring SharePoint performance. - Alert Pipeline: Creates ability to run custom code when alerts are triggered.
|
Add-ons to site settings and central administration
At this moment there is only one add-in for MOSS/WSS3 available: Event Receivers Manager. This add-in can be enabled via a site collection level feature. The feature activates a new link in the "Site Settings" which allows you to delete event handlers and add/edit new ones. A SharePoint solution is availalbe to install the functionality. More to come in the future. See El Blanco's blog: http://chrissyblanco.blogspot.com. |
|
A free add-on feature provided by Andrew Connell: the feature adds a new menu item to the Site Actions menu that lets you toggle into edit mode on (almost) any page.
|
|
If you ever needed to get all the details on a list including the ID, properties, content types, site column IDs, and more this feature is for you. Check out the feature on Karine's blog.
|
|
This CodePlex project provides a whole set of features that will definitely help you with adding functionality to the interface or administration tasks. Some examples: Print List (adds a "Print List" menu item to the "Actions" menu), Attach to debugger, Manage FBA Users (if you want an interface to edit ASP.NET membership users in SharePoint), Log viewer, Manage Configuration Modifications (to manage web.config changes), and many more.
|
|
The SharePoint for Hosters community site on CodePlex contains relevant information for shared hosting solutions on WSS3. There is a Solution Kit available which leverages a couple of custom components built for WSS3: - SQL Forms Based authentication - Custom SharePoint Web Services - Custom SharePoint Web Parts - HTTP Module for URL redirection
|
WCM tools and add-ons
|
A collection of sample Field Controls for use within Publishing Sites built using Office SharePoint Server 2007's Web Content Management features. For the moment only the only control available is the MultimediaFieldControl v0.9 but more will be added.
|
|
Andrew Connell's tool provides custom commands related to Web Content Management features in MOSS 2007 such as: generate content types, publish all, generate site columns. |
|
A collection of sample Web Parts for use within Publishing Sites built using Office SharePoint Server 2007's Web Content Management features. There are 3 web parts available at the moment: FAQWebPart, RandomFlashMovieWebPart v0.9 and ThumbnailWebPart v0.9. |
|
Override the default content query web part, and add advanced features such as context menus for the items, toolbar for lists (if the web part is connected to a single list) and so on. |
|
A set of utilities for MOSS 2007 publishing web sites. I particularly like the PropertyBagFeature feature that allows content authors to modify values within the property bag of pages, similar to the custom properties that were available in MCMS 2002. |
Site templates
|
A set of 40 application templates ready to use on WSS 3. A bunch of ready to use scenarios including: - Project Tracking Workspace - Integrated Marketing Campaign Tracking - Help Desk - Bug Database - Event Planning - Lending Library - Case Management for Government Agencies
|
|
Contains a set of templates, best practices and web parts for building community sites. Several templates and tools are available in the kit: - Enhanced Blog Edition - User Group Edition - CKS:Internet/Extranet Edition - Tag Cloud 1.0
|
|
SharePoint Learning Kit is a SCORM 2004-conformant e-learning delivery and tracking application built as a Windows SharePoint Services 3.0 solution.
|
SharePoint Designer 2007 tools and resources
|
This CodePlex project provides custom workflow activities for SharePoint Designer. Some of the activities you can find: - Send Email with HTTP File attachment - Send Email with List Item attachments - Is User a member of a SharePoint group - Grant Permission on Item
|
to more detail you can click this link http://www.katriendg.com/aboutdotnet/Resources-wss3-moss.aspx
Microsoft Windows SharePoint Services 3.0 Service Pack 1 (SP1) provides the latest updates to Windows SharePoint Services 3.0. Additionally, Windows SharePoint Services 3.0 SP1 contains improvements to security, to stability, and to performance. Some fixes that are included in Windows SharePoint Services 3.0 SP1 were previously released in separate updates. Windows SharePoint Services 3.0 SP1 combines the previously released fixes into one update.
For more information about Windows SharePoint Services 3.0 Service Pack 1, click the following article number to view the article in the Microsoft Knowledge Base:
http://support.microsoft.com/kb/942388/
you can click on this link, it is a good article to create a simple workflow with k2 blackpearl.
http://geekangle.wordpress.com/2008/02/20/blackpearl-web-forms-workflow/