I am using VSTO 3.0 and the ribbon designer gives me a ribbon that is apparently shared across documents.
So if I have Document specific state( number of XML marked up tags say) that needs to show up in the ribbon( or a toggle button ) then all documents seem to share the ribbon instance
How can I fix this
TIA
You can use Application.DocumentChange event or Application.WindowActivate event.
The first is fired then you change the current active document, but in the arguments there's no information about that document, so it's difficult to work with because you'll have to figure that out.
The latter is similar and it's fired every time you change of window but in this case it passes the current active document as an argument, so it's easier to change the ribbon if you need to check the value of any document property. That worked for me.
Hook into an appropriate event (such as when the active document is changed) within the document model, and in that event invalidate the appropriate ribbon button (you'll need the id of the element from the original Ribbon xml you load).
Then, when the refresh state callback for that button occurs, you can update the caption/image/enabled as required.
Related
In lotus notes 6.5.6 i want to do this:
select one document in a view and then i run an agent that show me a view(with picklist method) and I want the cursor should reach on a specific view entry based on and original's selected document field. it's possible ?
i know this is possible with prompt method specifying the 'default' parameter but i can't use this method because i have to propose a view and not a list of values.... it's possible to do this ? I want to see all entry in the view so i can't use SingleCategory
Unfortunately this is not possible, not even in Version 9 (that is a little newer than your Version from 2008).
You might be successfull by using the API to send keystrokes, but as you do not have an event that fires when the Picklist- Window opens it is very unlikely that you could place the keystroke- sending code anywhere.
I am new to CRM, and I have run into a requirement where I have to show some controls (textbox, option set, etc) and custom entities (sub - grid) as readonly. But, when I made them readonly, they appears like disabled and are getting grayed out. Is there any way to make them only read only not look like disabled?
Please suggest.
Thanks,
Ashfaq.
in CRM read-only means fields are greyed out but still they are readable.
If you want to make the fields visible as normal but don't want them to be editable by the user, you need to write JavaScipt for that.
Take the following steps.
1. Make the fields editable.
2. On form's OnSave Event, call the following method to prevent the attributes to be saved.
function PreventSave()
{
Xrm.Page.getAttribute(“CRMFieldName”).setSubmitMode(“never”);
}
It will not grey out the fields and still prevent the user to change their values.
I hope it will help you.
For text fields, there is one type of text field that when set to readonly does not look like it is disabled. Off the top of my head I can't remember which type. For the other field types I have not found a way to not have them look disabled when made readonly.
Other option is not to use form fields but show the data you need to be readonly (and not grayed out) in a web resource (HTML/SL/etc). Be aware tho that if your users are using outlook with crm addin, there are limitations here when the record is viewed in the outlook reading pane.
Only other option I can think of is to not set the fields as readonly but control any field data changes with javascript.
In short, I haven't found a good way to do what you need.
I'm working on a Lotusscript at the moment which places a menu of actions on the $Inbox (and thereby any folders derived from that design). This action menu has several items with "Hide action if formula is true" selected. The logic behind all of this works perfectly, however I now have the need to re-evaluate these formulas if the user performs certain actions within the folder (eg: if the action is hidden because a certain flag has been set, and that flag is changed I would then like to re-evaluate the formula so the action now appears). I can't seem to find any way to reload a folder or re-evaluate these formulas. Does anyone know of a way to do this?
There is a RefreshHideFormulas method for the NotesUIDocument, but not for a view. You may be able to call the ReloadWindow() method of NotesUIWorkspace, though, so that's worth a try.
As an alternative, triggering an agent that calls the #Command RefreshHideFormulas may also work for you:
Here is some code (borrowed from http://ideajam.net/ideajam/p/ij.nsf/0/3BBA7E25A972ABD88625759600445A50?OpenDocument)
1) Create an #Formula Agent called "RefreshActions", Agent List Trigger with the following code:
#SetTargetFrame("YourFrame");
#UpdateFormulaContext;
#Command([RefreshHideFormulas]);
2) In your Lotusscript, where you want to insert a "refresh frame" call, add this:
Dim agent As NotesAgent
Set agent = db.Getagent("RefreshActions")
Call agent.Run()
You can use property "Evaluate actions for every document change" found in view properties, [i] tab. Every selection (click, arrows) of document will trigger reevaluating hide whens for actions. Maybe it will work after refreshing view by some action.
We would like to block the deletion of documents in a list based on some custom functionality.
What we have tried is to implement this in the ItemDeleting event. Where we set the cancel property of SPItemEventProperties to true when we do not want the user to be able to delete a document.
What happened was that the Delete option in the dropdown menu disapeared when the user was not allowed to delete a document. In a way this works, but the event is firing before the user actually tries to delete the document.
What is giving us problems is that the user can delete a document if they connect to the document library via MS Word 2003. In that case it does not appear that the ItemDeleting event fires.
Is there a way that we can get an event to fire and rollback the deletion when the document is deleted via MS Word.
Edit
Part of the problem could be that events do not fire in explorer view. Is there a fix for this "bug"?
ItemDeleting - An event that fires before an item is deleted.
more click here
I do not have sharepoint development environment right now so I can not give the exact answer but you can check on one thing that when user performs any action on a document from MS Word 2003 ItemUpdating event is fired. You can explore ItemUpdating event to see what is going to happen with the document and then deal with it accordingly.
I have a simple event handler with a ItemAdding event that changes a column value that I need in the ItemUpdated method. After uploading a word 2007 document (*.docx, *.pptx or xlsx) the value of the column is changed, but when I protect the document the value of the column disappears in the ItemUpdated method. This only happens for office 2007 documents, other files don't clear the value.
The event handler runs in a document library in MOSS 2007.
Thanks
We have the same issue. It appears that the properties from the list are added to the office 2007 doc, but only with the default values for the field on upload/creation. Once the item is edited we are experiencing that the office documents values are overriding the values set in our event handler.
We do not experience this when using an asynchronous event handler, but the asynchronous event handler has conflicts with updates on other threads with certain types of updates.
We have a support call active with Microsoft about this very issue. They acknowledge this is not
No results yet.
Try using an asychronous event handler (it runs a little bit later than the code that updates from the office document), but with caution.
UPDATE:
A workaround is setting the SPWeb.ParserEnabled to FALSE will remove the connection to the document properties which will stop the above behaviour. It prevents the list properties from being added to the office document.
When you upload an Office document into SharePoint, it tries to extract column from the document and promote them to the list.
Do, check if your doc has any attribute set. If this is the case, it can explain what you see.
Note: open advance document properties and delete all custom properties to be sure
I resolve the issue putting the SPWeb.ParserEnabled = false in the ItemUpdating method.
code:
properties.ListItem.Web.ParserEnabled = false;
Thanks all for help
Setting SPWeb.ParserEnabled = false does work, but there are effects! One very noticeable one is that it will break site and list templates. If SPWeb.ParserEnabled = false, and you save a list or site template, it's meta data is not set (Feature ID, Product Version, etc) and it will not be available in the list of templates to choose from. You might be able to get around this by resetting SPWeb.ParserEnabled=true during the itemUpdated event, but I haven't fully tested whether this will resolve all issues yet...