.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

How to rename the document using event receiver during upload

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :SharePoint
Hi all, I am going to programmaticlly rename the document when it is being uploaded to the document library. In Visual Studio 2010, I used the event receiver and choosed the documment libray type, for the event I selected 'ItemAdding". However I am not able to update the file name using the codes inside this thread: http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/5c3dcc5d-3113-463d-8835-2a050b2471a6/ Can anyone help me with this problem? Thanks!

View Complete Post

More Related Resource Links

event receiver to update created field of uploaded document

Hi,   I need to update the created column with the document creation time . 1) First should i use ItemAdding event or Item Added event 2) how do i get the file created properties and assign it to the cdocument library created column.

Event receiver while item adding in a document library in SharePoint2010



In my SP site i have various document sets.while i adding a new doc in the document set,i have to find the document belongs to which document set.I want to do it an event receiver..Please help me.

SharePoint 2010 Event Receiver verifying Content Types inside Document Sets


I have a document library and document set is added as one of the content types. The user goes inside the document set and inside the document set, I have 2 different content types. Now my scenario is that, one of the content types - which is referred as Main Report should not be used twice. I mean, within the document set, only one document of Main Report content type should exist. How can we do this?


Event receiver while item adding in a document library in SharePoint2010



In my SP site i have various document sets.while i adding a new doc in the document set,i have to find the document belongs to which document set.I want to do it an event receiver..Please help me.

Upload a File to a SharePoint Document Library - Part I

The following helper class demonstrates a few techniques that allow documents to be uploaded to a SharePoint document library programmatically without using the API or a custom web service. You don't need to specify a document library name, and it will create any folders specified in the URL as required. File meta data will be updated if any properties are passed.

file upload in Create User Wizard Created User event with UpdatePanel Tag wont work?



In my Create User Wizard1 Created User Wizard Event, I am collecting extra information from text boxes and allowing

the user to uplad a file.



I have put the Submit button within an Update Panel Tag but since I have done this it does not work.

Is there a way round it. In this situation would you use a trigger.?


<br />

  <asp:UpdatePanel ID="UpdatePanel2" runat="server">

  <asp:Button ID="StepNextButton" runat="server"  CommandName="MoveNext"  align="middle"
                                            Text="Submit my Profile" />

How to write an event to manage permissions on a document while uploading, depending on custom field



I am trying to find a solution to manage permissions on a document, while uploading it into a document library. This event has to be fired if a custom field is populated (it's a check box field).

How to write an event for this, i tried writing ItemAdded event, but this is getting fired as soon as a document is uploaded, before coming to the page, where we populate all the fields and hit check in.

can i capture Check-in event.

Please advise.


Reg File Upload control to upload files from document library


In Field Upload control if we click browse button it allow us to search file in our hard disk but now as per my requirement as soon as user clicks ‘Browse’ button it should point to the document libraries and their files in site.Let me know how could i achieve this?

Thanks & Regards,


Why feature with event receiver doesn't activate properly after site provisioning?



I have defined feature with event receivers for my document library and for users List .

I try to activate my feature in onet.xml in section <WebFeatures>. After provisioning a new site from onet.xml  all work fine and my feature is shown as activated, but event receivers doesn't fire. It fires only after reactivating my feature (deactivate, then activate it again). But I need my feature works immediately after site provisioning without deactivating and activating it again. Who knows how to solve this problem?

part of ONET.xml



        <Feature ID="00BFEA71-4EA5-48D4-A4AD-7EA5C011ABE5"/>

        <!-- TeamCollab Feature -->

        <Feature ID="F41CC668-37E5-4743-B4A8-74D1DB3FD8A4"/>

        <!-- MobilityRedirect -->

        <!--My EventReceivers Feature-->

        <Feature ID ="41178843-A6A4-47c7-9EF9-B8A432E02B88"></Feature>





question on attachments/document upload in SharePoint

Scenario: I have business need where I need to attach some documents to a document library. My users fill out a form, which is a custom List Form in a list called "Request" but on the same form I want to provide my users a document upload feature which will save the document to a document library called "Request Documents".

In other words, request information such as Title, Department, Description etc get saved to "Request List" (SharePoint List) whereas the documents attached/uploaded (if there are any from the user) while filling the same request form out, get saved in the "Request Documents" (SharePoint Document Library) with the same ID #. If Request ID was 100, then the uploaded document(s) in the Document Library should also be 100.

I tried a few techniques out, and I'm reading some more on Data Source Library of SharePoint but I believe I need some help from the community before I do anything further.

Upload documents to Sharepoint 2010 Document library

Is there a way to upload documents to an SP 2010 document library with Custom Actions or Workflows?  I have a requirement of taking the contents of several directories (older data files) and uploading them to Sharepoint.  Not sure which actions actually perform this operation.  Any help most greatly appreciated.

New / Upload / Actions / Settings / View menus on a document library are hidden

I have a Document library. On the View Page (All Documents) for the Document library, I do not see the menu bar with the "New / Upload / Actions / Settings / View" menus. It looks like one of the users with owner permissions did something to cause this behavior. No custom code exists on the page. I am not sure how this menu bar can be hidden. Can someone please clarify. I am a site collection administrator.

How To "Upload a new document template" to Content Type via Web Service

I hope someone can help me. Let me begin by saying that I'm not a programmer; so I 'may' not get the terminology exactly right, but hopefully someone will know what I mean. I am using SharePoint 2010 along with a 3rd party application that I'm using for creating, managing and executing workflows.  The workflow application I'm using is Nintex Workflow 2010.  As such, I can only use functions, services, commands...etc...that are offered to me by that application. Anyway, what I am trying to do is simply replace a document template that is being used for a particular content type with another document template. For this I believe I need to use the Webs.UpdateContentTypeXmlDocument Method.  More information is provided here (http://msdn.microsoft.com/en-us/library/websvcwebs.webs.updatecontenttypexmldocument.aspx). The Webs.UpdateContentTypeXmlDocument method requires two parameters..."contentTypeId" and "newDocument". "contentTypeId" - I have got the Content Type ID by clicking on the content type and viewing the URL shown in my browser.  So, I am confident that my content type id is correct and is "0x010100C392CF11DE923A4E8AB9018B0A42119303". "newDocument" - The MSDN article states...'A string that represents the XML document to replace the existing XML document.".  To be honest, I'm not 100%

How do you rename a document in Batch Update?

Hi, I have tried to rename a file as so. xml += "<Method ID='" + currentID + "' Cmd='Update'>"; xml += "<Field Name='ID'>" + ID + "</Field>"; xml += "<Field Name='FileRef'>" + fileRef + "</Field>";   xml += "<Field Name='LinkFilename'>" + "Accommodation.pdf" + "</Field>"; </Method> I have tried Name instead of LinkFilename and still no joy. Can anyone help. Thanks. John.

Event handler to delete minor versions in document libraries

Hi Is there a way we can capture the deletion of minor versions in document libraries using any event handler. May not be using the delete all the minor versions but at least when we use the option to delete the selected minor version. I do not see the ItemUpdating and ItemUpdated getting fired in this case. Thanks wpwije  

Rename a document in Doc Library without changing the modified by

How do I rename the document in the document library without changing the modifed by and no increment of version? My Document Library setting is Major Version and CheckOut is set to No. I'm using SPSecurity.RunWithElevatedPrivileges to rename the document I had tested to checkout then checkin but there is an increment in version. Here is a sample code that will rename the filename but the modified by changed to System Account. SPSecurity.RunWithElevatedPrivileges(new SPSecurity.CodeToRunElevated(delegate() { using (SPSite elevatedSite = new SPSite(SPContext.Current.Site.ID)) { using (SPWeb elevatedWeb = elevatedSite.OpenWeb(SPContext.Current.Site.RootWeb.ID)) { elevatedWeb.AllowUnsafeUpdates = true; SPList list = elevatedWeb.Lists["Library1"]; SPListItem item = list.GetItemById(documentID); if (updateFilename) item["Name"] = filename; item.SystemUpdate(); } } })); Is there anyone out there who can help? Thanks in advanced.

Intercept Check-In Event of Document Library in SharePoint 2010

we need to intercept the default check-in Event of the Document Library. The detailed requirements is as follows.   1. Intercept the check-in Event of Document Library. 2. Instead of the default check-in  page (normally this is the layout's checkin.aspx page), show our custom application page. 3. In the custom application page, allow users to provide some inputs. Validate the input values against values stored in database. 4. Once validated successfully, allow user to check-in the documents. Else, do not allow user to check-in the document.   One more additional requirement is the above things should happen only for our custom content type. In order to achieve the same, we are planning for deploying our custom document content types and perform the above operations on check-in event of the documents.     Another approach of performing the same is , have our own custom ECB Menu. The detailed process is as below.   a. Customize the check in menu (ECB) b. Show the custom form and get the inputs from user and do the validations c. On the OK button click, if validation is success, then update the meta data and check in the document or deny the process. d. But in this approach, we need to check the libraries version settings and that default functionalities should be added automatically to the check in process.   At this point of time, we a
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend