Complex lookup metadata in document library - c#

A client wants to have a lookup field for customer name found in a database as metadata on a Word document in a document library. They have a code which represents a group of customers and one of them should be used as customer name as metadata as well as the customer code inside the document.
Since editing the metadata in Word leaves no room for extra logic like external database lookup, right?, we have to tweak the EditForm.aspx with Asp.Net or java script to add the functionality to lookup external data.
The hard part is that we need to make the user fill in the metadata in SharePoint before the document is opened. Otherwise the user must create, close, edit metadata and then re open the document. The default behavior of SharePoint is to open the document first and let the user edit the metadata inside Word.
My first thought was to create a custom action for each content type and redirects the user to a page that creates the document in code and then brings the user to the EditForm page. Alternatively use codebehind for the custom action to create the document and let the user edit metadata in the EditForm. Clicking OK after that would save the metadata and bring up the document itself.
Then I stumbled upon EventRecievers and thought that might solve my problem. To intercept the creation of the document and send the user to the EditForm page first.
What is your thoughts on this, and how would you solve this problem?

This sounds like a job for the Business Data Catalog, that allows for incorporating external data inside your sharepoint lists (i.e. as a column). This does require a SharePoint 2007 Enterprise license.

Related

Working with multiple custom DocuSign anchor tags

Using DocuSign developer API I am relying on anchor tags to add custom tabs to the document that a user uploads to my application.
I came up with custom tags such as text, signature, and date. With minor training to users who will be creating signature docs I tell them when there are multiple of the same tag you need to increment the number.
/text1/
/text2/
/text3/
/signature1/
/date1/
The user uploads the document to my site. In my code I am reading all of the text in the document, validating it. Looking for occurrences of "/text", "/signature" and "/date". For each occurrence I am creating a DocuSign tab of that type and adding them all to the document. Then sending it out for signing.
Does anyone have a better way to do something like this?
You could try using automatic anchor tag placement.
Inside of your DocuSign account there's a section dedicated to Envelope Custom Fields. It's worth mentioning that this technique is usually used through Salesforce, but if you're creating envelopes directly through one of the DocuSign APIs it should also work.
https://support.docusign.com/guides/dfs-admin-guide-automatic-anchor-text-and-tags
Essentially how it works is that you create a tab at your account level with a label on it similar to /text_{r}/. When you create your underlying doc, you replace the {r} with the recipients position in the signing order.
This way, any instance of /text_1/ will have the custom tab with the /text_{r}/ anchor string added for recipient 1.
Pending on how you want your app to be set up, you should also know that all instances of /text_1/ will be added to as a group with a duplicate data label. What this means is that if you add text to one of them, all of them will be updated.
If this isn't how you want it to work you can continue to use the /text1_1/, /text2_1/, /text3_1/ format you're already using. If you have all three of these on the underlying document, an individual tab would be automatically placed that would be independent of each other and all placed for the first recipient in your routing order.
It would take some effort to set up, but it would save you the effort of having to validate and automatically add all of these fields -- DocuSign would do it for you.

How to create Spotfire datasource with multiple tables

I am developing spotfire data source and using this, my datasource is going to get data from multiple URL's. For each URL I have to create a table in spotfire. Could you please show me some code to achieve this.
First, note that a single data source object can only produce a single table. That is, you cannot "hardcode" a list of URLs in your DataSource class. However, you can supply a single URL as parameter and require your user of the Spotfire Professional Client to enter the URL when he creates the data table (e.g., by clicking File -> Add Data Table) and have him/her do that multiple times.
The important step in implementing this is to make Spotfire aware of the information supplied as a parameter and make this information serializable (Spotfire Prof. has to store it somewhere in the DXP after all). You do this by writing a "PromptModel" class, registering together with the associated View (the form that will be displayed to the user to prompt for the URL), and then doing some wiring (registering, implementing the right constructor, etc.).
The example that you linked glances over this stuff unfortunately (you see some comments saying "Not shown..."). However if the Spotfire SDK (TIB_spotfdev*.zip), you'll find a more extensive example called "SpotfireDeveloper.CustomDataSourceExample" that takes care of all these steps.

Customizing or Catching SharePoint ribbon action "New Document" in document library

I was wondering if it is possible to catch or customize the "New Document" action in the ribbon when you create a new document in a document library.
The reason is the following: I would like to fill in some data into the document (pragmatically through the properties) before it opens in Word. This way some default data is filled in for the user. What data is filled in depends on the Site name. This would represent a Project number, what would be used to get the specific data from a list or database.
I've come up with some other solutions that basically fill in the data, but at another point of the process of the document:
using a combination of a Workflow & filling in the data through InfoPath. This works for a library with only 1 content type (the default). Once we want to use multiple Content types it is nearly impossible to get the site name because InfoPath is not able to use the function SPContext.Current.Web.Title.
To solve the content type problem I used the Event Receiver "ItemAdding". This way the data is added when the document is being added. The disadvantage that this gives is that the data will only be visible in the document if the users opens it a second time, what isn't really user friendly.
So to optimize the user experiences and usability I would like to add the data before the document opens in word. But is it possible?
I'm using SharePoint 2010 Server, Office 2010 Professorial and Visual studio 2010 Ultimate.
Thanks in advance,
Oxillery

Using InfoPath for importing and exporting data

The application I'm writing has a need for a solution to the following situation:
Salesman and customer is located offsite. They are finalizing a list of requirements, and will input business data that at some point need to be inputed in the onsite database.
My idea is that the salesperson gets a InfoPath document that is almost completed with default values and heads over to the customer. While at the customer the document is updated to satisfy the customer's need. I must also cover that the document is passed back and forth by email between the salesperson and the customer.
When the salesperson returns to the office he uploads the InfoPath into the database and the order is updated with few user interactions.
Now to the questions:
Is this a workable/sensible solution? Other suggestions to how to solve this?
How do I ensure that form and data stays together when the salesperson takes the document on a USB stick or it's emailed to the customer?
How do I (with C# code) fill a form with default values?
How do I read back the changes?
Sharepoint is not an option.
Some issues that you will need to think about
will customer have infopath installed and therfore may not be able to view the document.
If you email the document or need a customer to view it, generally only the data is transmitted with a pointer to the Form Template. If you want the customer to update it and send it back, then the template will need to be located somewhere publicily accesseable.
The data is stored as an XML document so as part of the startup you could detect that it is a new form set the defaults that you need.
when you publish a form to a networked folder it will also ask for a local path for the form. this allows for a disconected scenarios.
From my experience, InfoPath is a great tool when you have control over the environment. It starts to break down as a viable option once you get outside a controled environment, because you then have to start jumping through hoops to make it work as it should.
EDIT
One you loose control of the environment I think that a web interface would be the way to go.
The sales person could create a new document on the website with the back-end populating all the defaults necessary. A link to the document could be emailed to the customer, who could update their stuff via the web interface and then sales person can then finalise the process.

Setting up user permissions for reading and writing document files in IIS7

I want to make a very simple CMS for my sites. So what I am thinking is this a user logs in and a list of their pages shows up. Now they change their ends and save it. My C# code would then write over the file/section.
So I don't think it would be to bad to do this however I am not sure about how it works with read and write premission and how to set it up.
Like I want the user to only be able to read and write to their files they own.
So if User A has Page1.html and Page2.html they can only read those files and write to those files they can touch User B's page3.html and Page4.html
So how would I setup this up?
Thanks
When you create your list of files, you will be reading that list from a database repository. Include in that code conditions that allow only those records for which the user has permission.
The most straightforward way to do this is to create a table with two columns: UserID and DocumentID. A presence of a record in the table indicates that the user has permission to that particular document. Add records to this table that give the user permissions to the appropriate documents.
Then, when you read the documents from the database, you can join this table to the documents table via the DocumentID, and filter the table by UserID. This will return only those records for which the user has permission. You can then use that set of records as the basis for the list of documents that you display to the user.
You could employ a cms the SharePoint way. You begin with a base file on the network. If a change to it is made then the page is stored in a database. each subsequent change is a db change and the application renders the last entry in the table for that page.
this does two things. first, you can see revisions and re-instate them. you can see a complete history of the page, who made the changes and when.
it also allows you to lock pages within the database and assign roles/users against the pages. you can then apply a decoration to the controller which checks rights and either renders the page or displays a access denied page and then log the attempted access to the page.
i know this sounds complex but can you foresee a time when after you've gone live with your cms that the client is going to want more from it? you need to implement a solution that's adaptable to needs.
if it's worth writing then it's worth writing well.

Categories

Resources