How to force a new document to check in using an event receiver

Hello,
I need someone to guide me how to achieve using an event receiver or any other method how to force a document to check in. I have some users that forget to check in their documents. I have a workflow that runs every time a new document is uploaded and check
in to run an approval process. Hope anyone can help me with this.
Best Regards,
Fer

You can check-in document in the ItemAdded event
Example:
namespace MultipleFileUpload.MultipleItemsAdded
/// <summary>
/// List Item Events
/// </summary>
public class MultipleItemsAdded : SPItemEventReceiver
/// <summary>
/// An item was added.
/// </summary>
private Guid siteID;
private SPFile file;
public override void ItemAdded(SPItemEventProperties properties)
siteID = properties.SiteId;
file = properties.ListItem.File;
using (SPSite site = new SPSite(siteID))
using (SPWeb web = site.OpenWeb())
base.ItemAdding(properties);
SPListItem oItem = properties.ListItem;
oItem["Title"] = "Please add a title.";
oItem["Description"] = "Please add a description.";
oItem.Update();
if (file.CheckOutType != SPFile.SPCheckOutType.None)
file.CheckIn("Automatic Check In");
[custom.development]

Similar Messages

  • How to get Folder or document service permissions  by using  KM API's

    Hi,
    Any help how to get Folder or document service permissions  by using  KM API's  
    Any help or hint is greatly appreciated.
    Thanks,
    Costa.

    Hi,
    I have tested it here and it works for me (this code lists the service permissions settings for folder /documents/temp/):
        RID rid = RID.getRID("/documents/temp");
        try {
          IUser user = (IUser) request.getUser().getUser();
          IResourceContext context = new ResourceContext(user);
          IResource res = ResourceFactory.getInstance().getResource(rid, context);
          IResourceFactory resourceFactory = ResourceFactory.getInstance();
          IRepositoryServiceFactory serviceFactory = resourceFactory.getServiceFactory();
          IAclService aclService = (IAclService) serviceFactory.getRepositoryService(res, IWcmConst.ACL_SERVICE);
          IResourceAclManager aclResourceManager = aclService.getAclManager();
          IResourceAcl resourceAcl = aclResourceManager.getAcl(res);
          boolean inheritedAcl = false;
          if (resourceAcl == null) {
            resourceAcl = aclResourceManager.getInheritedAcl(res);
            inheritedAcl = true;
          response.write("<strong>SERVICE PERMISSION OWNERS</strong><br>");
          IUMPrincipalList ownerList = resourceAcl.getOwners();
          IUMPrincipalListIterator ownerListIt = ownerList.iterator();
          while (ownerListIt.hasNext()) {
            IUMPrincipal ownerPrincipal = ownerListIt.next();
            String strPrincipal = ownerPrincipal.getId();
            response.write(strPrincipal + "<br/>");
          response.write("<br><strong>SERVICE PERMISSIONS</strong><br>");
          IResourceAclEntryList el = resourceAcl.getEntries();
          IResourceAclEntryListIterator it = el.iterator();
          while (it.hasNext()) {
            IResourceAclEntry entry = it.next();
            String strEntryPerm = entry.getPermission().getDescription();
            String strPrincipal = entry.getPrincipal().getId();
            response.write("<strong>" + strEntryPerm + "</strong> - principal: " + strPrincipal + "<br/>");
            IAclPermissionList plList = entry.getPermission().getMembers();
            IAclPermissionListIterator plListIterator = plList.iterator();
            while (plListIterator.hasNext()) {
              IAclPermission perm = plListIterator.next();
              response.write(perm.getDescription() + "<br/>");
        } catch (Exception e) {
          response.write(LogWriter.extractCallStack(e));
          LogWriter.traceSevere(LogWrapper.trace, e, LogWriter.extractCallStack(e), true);
    Romano

  • How to force a new password in portal with LDAP user? external users

    With an external portal (used by agents that do not work for you or reside in your office), company policy is for password to be changed every qtr.
    If the users are creating as LDAP users how to force them to change their password when required?
    Is this a custom application that needs to be written so when they log into the portal if the qtr has expired the portal ask them to enter a new password that becomes valid for the next qtr.
    Versus internally deleting and emailing all the users a new password?

    Hi Glenn,
    We are getting one problem when we are creating user in LDAP and login with that user in  Portal that time we are getting Password change screen , but when we create a user in LDAP and change the password of that user in LDAP then when the user tries to  Login to portal that time we are not able to see the password change screen.
    But again if we change the password of that user through Portal we are able to see change password screen.
    can you help on this how we can force the user to change password when we are changing password in LDAP or in SAP System.
    Regards
    Trilochan

  • How to integrate a new document in workflow ?

    Hello,
    I have created a new Document in SAP B1. I want this document to be validated like quotation/order documents  in the application. Is it possible to integrate it in the native SAP B1 workflow or how can I create a new workflow for this document ?
    Thanks in advance !

    Armand,
    When you say "native SAP B1 workflow or how can I create a new workflow for this document", I am assuming that you are referring to the Business One Approval Process?
    If this is correct, unfortunately documents that are added via the DI API do not trigger the Approval Process.  This is documented in the SDK Help documentation under the Documents object
    With respect to "validation", any transactions or data that come through the API's are validated by the API's.
    Eddy

  • How to create a new document type for PO and Requisition

    Hi All
    Can you please help me with the steps of creating a new document type for PO and PR. Also the steps that need to be update for the procure pay cycle to work properly. 
    Once the document type is been created. I want to create the PO referecing the new PR and PO document type.I am new in MM.
    Thanks, Ros

    Hi,
    1. You can create new PR and PO docu types at the following path:
    For PR docu type:
    First you need to create number range for docu type or you can use existing number range also. The path for creation of no. range is
    SPRO>Materials Management->Purchasing->Purchase Requisition->Define Number Ranges
    Then create PR docu type at below path and assign no. range to PR docu type here only
    SPRO>Materials Management->Purchasing->Purchase Requisition->Define Document Types
    For PO docu type:
    Follow same procedure as mentioned for PR docu type. Path is
    SPRO>Materials Management->Purchasing->Purchase Order->Define Number Ranges
    SPRO>Materials Management>Purchasing->Purchase Order->Define Document Types
    If you want to create PO referencing new PR docu type, link the PR docu type to PO docu type at below path:
    SPRO>Materials Management->Purchasing->Purchase Requisition->Define Document Types--> Link purchase requisition - document type
    Regards
    Chetan

  • How to create a new document with a given theme, instead of choosing it every time.

    Hi,
    for work I only use a custom made keynote theme.
    I've already deleted all the default themes, and the only one that is listed in the app is the one I actually use.
    However every time I create a new document I have to chose its theme (that's normal having plenty of themes, but in my case is just a waste of time).
    I was wondering if there's a way to tell keynote to start a new document with a given theme, in order to avoid to chose it every time.
    Thank you for reading and for the help you will give.
    Giacomo

    Keynote > Preferences > General tab
    select “Use theme,” and then click Choose to select a theme.

  • How to force a new spool in a Programme

    Hi,
    Is there a way for me to force a new spool to use in a background job of an ABAP programme?
    I'm currently using the 'write:/' statement to output to spool and then getting the spool request number and converting it to a pdf. I then delete the spool.
    This works perfectly for the first iteration of a loop, when I then come to the second iteration my write stement appears to attemt to write to the same spool number as my 'get_spool_request' function is returning the same number as the previous iteration and then falls over when it attepts to convert to pdf.
    Any help appreciated.
    Rob

    The way I have approached this in the past, is to have seperate ABAPS.  One ABAP does the report creation and writing, this is then called via SUBMIT from another ABAP.  This calling ABAP then picks up the spool number and performs the  PDF conversion.

  • I need to know how to easily convert a document to a pdf using ocr.  I need a "readable document".  Please help.

    How do I convert a document to a pdf document using ocr.

    I typically create a TEST folder on the remote site.  Upload new pages and dependant files there for debugging and testing purposes.  Then using a 3rd party ftp ware (filezilla, cute ftp or Ws_ftp pro), I move the new site files & folders over to the root directory.  If you have used the same filenames as were on the old site, new pages will overwrite the old ones.  If you used a different naming convention, you will need to delete old files from server.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb

  • How do I perform an action on a document in a library, before my Event Receiver is fired?

    My scenario:
    Currently when a document is uploaded into a document library, it gets its metadata from the document. But then there is a need to change the title property to satisfy a naming convention which basically concatenates a combination of the information in
    other columns in the document library...right now, there is already a SP designer workflow that is doing this and updating the title field (this was done previously by someone else). Now I want to add an event receiver to the library which will change
    the "name" property of the document. The name will be changed to match the title field (I think I already know how to do this part).
    Here is my problem...if I create an Event Receiver (ItemAdded), my code will not work cause the workflow needs to fire and complete its task before my code can grab the value from the title and copy it into the name. So my question is this....is there
    a way in SP that i can maybe write custom code to address the entire scenario? If so, how do I do this? I read somewhere that I cannot or should not combine a workflow and an Event Receiver...I really appreciate it if I can be pointed in the right direction.

    I think you can use ItemAdding event to update your fields. This works better for you instead of ItemAdded event.
    Bala

  • How can i get new apple id with out using credit card or visa card

    how can i get a new apple id with out using credit card or visa card?

    Hi xianlycier06,
    If you are looking to create an Apple ID without using a credit card, you may find the following article helpful:
    Apple Support: Creating an iTunes Store, App Store, iBooks Store, and Mac App Store account without a credit card
    http://support.apple.com/kb/HT2534
    Regards,
    - Brenden

  • How do I force a new document at the end of an invoice form?

    I created an invoice form to pull data from an ERP system.  There are parameters that select the invoices based on salesrep#.  I then set up an automatic email that sends invoice copies to salesreps the 2nd day after invoice date.  The invoice copies are sent in 1 PDF attachment and within that attachment can be as many invoices as were created on the date parameter.
    I now have a request that each invoice copy be a separate document so the salesrep can forward that one invoice.  How would I do this while maintaining the automated email delivery?

    Please re-post if this is still an issue to the Business Objects Integration Kits - SAP
    Forum or purchase a case and have a dedicated support engineer work with your directly

  • How to:  make a new document in Pages based a Pdf layout (same measures)

    Hi,
    hope someone can help me,
    for a couple of days I have been on Google looking for a solution, but I can't find any
    I have a macbook ( Mavericks) and iWork / PAGES to make bussinesscards, invitations, flyers ....
    From the online printershop Flyer.be  I received a PDF- layout with the exact messures on how my documents must be.
    I know that from Pages I can tranfer my new made documents to PDF (as the printershop requiers) that's no problem
    BUT
    how do I import their PDF-layout into PAGES?
    can this be done in Automator, if yes, How?
    can I convert their PDF to a Template for PAGES?
    if I don't use their PDF- layout but simply use the original Templates that are in PAGES (for example: envelop), the messures are never the same as those required by the printershop,  how can I solve this?
    Dus: I need to find out how to use their messures and be able to work in iWork.
    Hope it's clearly explaned - as my native language is Dutch
    Anyone ? any idee?
    Thanks in advance.
    Greetings Speedy

    That is not a template for a Business Card. It looks like the template for a Compliments Slip 210 x 100mm.
    Also you do not use the Ruler to position things accurately, you use:
    Format > Arrange > Size/Position
    It looks like the Printer wants each item to be its own document, with Page setup to final size.
    There will be a problem however with the page bleed (the image that goes off the edge of the paper) because Pages does not have this.
    Swift Publisher does.
    PDF files are usually not editable, but Adobe Illustrator will open them and edit them and has all the tools you need to format the Stationery.
    Sketch can also open and edit pdfs now and is IMHO absolutely brilliant as well as beautiful to look at.
    Peter

  • How do I save NEW documents from Office 2011 to SP2010?

    Hi,
    We are using Office 2011 for Mac, with Safari and SP2010 for collaboration room and document libraries.
    Accessing, opening, reading and saving existing documents from SP2010 works all fine.
    But if I, after having opened and edited a Word document, want to do a "save as" to Sharepoint, how do I do it without having to temporarily store the document somewhere else.
    The "Share - Save to Sharepoint" in Office could be useful if I only could browse thru the folder hierarchy in the saved Sharepoint Locations. I have too many folder to add them all as "Sharepoint Locations".
    I have also tried to MS Document Connection, but as long as I cannot see the Document Connection from Office, it doesn't help much.
    Any advice?.

    I'm not a Mac user, that's my caveat, however there is a button on the ribbon for SharePoint Document Libraries on the Library Tab called Connect To Office.
    If that works with Office 2011 you'll start seeing your SharePoint site as a place where you can store documents in Office.
    Otherwise, you need to click "New" in teh library itself and have SharePoint open Office for you.
    w: http://www.the-north.com/sharepoint | t: @JMcAllisterCH | c: http://www.b-i.com

  • How to include a new field for checking duplicate customer master

    Dear All
    we have activated the standard procedure to check duplicate customer master data. This is a standard procedure as below :-
    Procedure:
    Run SM30, key in Table V_T100C, select Display or Maintain, set App area F2. Here you can change current settings.
    Check the transaction OBMSG for application area F2, where these messages are maintained and at this place you can convert the message from warning to error.e user needs one more field to be added to this check.
    It is working perfectly fine but it only compares two fields for duplicates in the customer master i.e the customer city and name.
    Is there a way to include a new field in this procedure ? For example we also want the system to check duplicate entries for field name " street 5" and give a warning /error message incase if there is another entry already existing on the master data.
    regards,

    Hi
    Use the enhancement SAPMF02D to check these values.
    Regards
    Eduardo

  • How do I add new document?

    I'm trying to figure out how to copy and paste from notepad to create to PDF?

    The Adobe Reader does not support creating PDF. Best you could do is copy text and copy it into an Annotation (after creating an annot).
    Pat

Maybe you are looking for

  • Open url in a remote panel

    HI. I want to put a button that launch a webpage. I works fine locally, when I click OK button, a  new internet window browser is open with the URL. But if I take the control in other PC client (using Web Publishing Tool) and I click OK button a inte

  • Invoice Blocked Email Notification

    Hi experts, I'm having a problem where i could set email for a certain transaction. Like my case, My invoice have been blocked and it had sent a mail to the requisitioner and a certain email add for a specific company code(group mail). I want to chan

  • Problem with video playback

    I just updated to 3.6.14 and after I did I'm now having problems viewing videos. The video plays, but in the right third of the screen there is a flashing block of red. Here's a screen cap of what it looks like: http://www.flickr.com/photos/25730352@

  • Can I use hotspot tethering in iPad mini with wifi??

    Can I use hotspot tethering in iPad mini with wifi??

  • Add Selection Dimension Members in package LoadInfoprovider

    Hello, I have a requirement where i have to add dimensions Entity and Time into standard package LoadInfoprovider. I need to allow user to choose wich entity he wants to extract from Bw infocube into BPC infocube. Using the transformation file to do