Which file would you create the SP View object in? Would you know the
steps for doing this and how to use code to copy the view around?

 

Thanks.

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Brian Farnhill
Sent: Thursday, 28 August 2008 10:03 AM
To: listserver@ozMOSS.com
Subject: RE: [OzMOSS] Setting Library View Programmatically

 

It is possible to create views from code. There are a few ways of going
about it but basically you create the SPView object and then add it to
the Views collection of each document library. I'm pretty sure you could
create the view in one spot and then use code to copy it around (I don't
think there would be any issues as long as each document library had the
required columns for the view).

 

Brian Farnhill 
Consultant
Technical Consulting 

Mobile:   0408 289 303
Fax:      02 8001 7778
Email:    [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> 
Web:     www.uniqueworld.net <http://www.uniqueworld.net> 
Blog:     pointstoshare.spaces.live.com
<http://pointstoshare.spaces.live.com/> 

 

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Anthony Lee
Sent: Thursday, 28 August 2008 10:05 AM
To: listserver@ozMOSS.com
Subject: RE: [OzMOSS] Setting Library View Programmatically

 

If we have a number of existing sites that has a document library which
has the same views, and one day we decide to add an additional view to
the document library, is it possible to replicate that view across all
the existing sites' document library? i.e. programmatically add that
view to the document library on all sites, without having to manually go
into each site to create that new view.

 

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Brian Farnhill
Sent: Wednesday, 27 August 2008 7:59 AM
To: listserver@ozMOSS.com
Subject: RE: [OzMOSS] Setting Library View Programmatically

 

You can add any of the fields to a view based on their internal name.
For example, the internal name of the field for the documents icon is
"DocIcon" and the correct field to use for the title field with the edit
menu is "LinkFilename". 

 

If you are unsure what the internal name of a field is that you want to
use a view, you can try this - build the view in SharePoint and then go
to the 'modify this view' page. Then with the IE Dev Toolbar (or firebug
if you are a fix fox user) select the check box for the field you need
the internal name of. You will see that it has an onclick attribute that
will look like this "javascript:ShowHideTotals(this, 'LinkFilename')".
The internal name for the field the checkbox corresponds to is the
second parameter in the JavaScript function.

 

I hope that helps

 

Brian Farnhill 
Consultant
Technical Consulting 

Mobile:   0408 289 303
Fax:      02 8001 7778
Email:    [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> 
Web:     www.uniqueworld.net <http://www.uniqueworld.net> 
Blog:     pointstoshare.spaces.live.com
<http://pointstoshare.spaces.live.com/> 



 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Witherdin, Nigel
Sent: Wednesday, 27 August 2008 2:16 AM
To: listserver@ozMOSS.com
Subject: RE: [OzMOSS] Setting Library View Programmatically

 

OK, I found a cheat of a way to do this, by cloning the "All Documents"
view and removing/adding fields as I needed to.  But I would still be
interested in knowing how to add these "special" fields programmatically
if anyone knows?

 

Cheers,

 

Nigel Witherdin

Senior Support Analyst

Eversheds

 

Direct Dial: +44 (0) 84 549 754 17

Mobile: +44 (0) 7738 553256

 

www.eversheds.com <http://www.eversheds.com/> 

 

 

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Witherdin, Nigel
Sent: 26 August 2008 16:49
To: listserver@ozMOSS.com
Subject: [OzMOSS] Setting Library View Programmatically

Hi All,

 

In a feature event receiver I am trying to create some views for a
particular list as per this code:

 

----

//Ordered by Reference number

SPViewCollection views = spLibrary.Views;

StringCollection libViewFields = new StringCollection();


libViewFields.Add("File_x0020_Type");
libViewFields.Add("Reference_x0020_Number");
libViewFields.Add("Modified");
libViewFields.Add("Item_x0020_Author");
libViewFields.Add("Item_x0020_Title");
libViewFields.Add("FileLeafRef");
libViewFields.Add("Group1");

 

qry = "<OrderBy><FieldRef Name='Reference_x0020_Number' Ascending='True'
/></OrderBy>";
libViews.Add("Ordered by Reference Number", libViewFields, qry, 100,
true, false);

 

spLibrary.Update();

----

 

This is all working fine, but I would really like to add the "File Type"
column so that it shows an icon for the file type, and the name
(FileLeafRef) column so that it has the dropdown edit menu.  Anybody
have any idea how to create these view fields programatically

 

Many thanks

 

Nigel Witherdin

Senior Support Analyst

Eversheds

 

Direct Dial: +44 (0) 84 549 754 17

Mobile: +44 (0) 7738 553256

 

www.eversheds.com

********* This email is sent for and on behalf of Eversheds LLP
*********

This email is sent for and on behalf of Eversheds LLP which is a limited
liability partnership, registered in England and Wales, registered
number OC304065. Registered office One Wood Street, London, EC2V 7WS.
Registered VAT number GB820704559.  A list of the members' names and
their professional qualifications is available for inspection at the
above office. Regulated by the Solicitors Regulation Authority (see 
www.sra.org.uk <http://www.sra.org.uk/> ). 

Confidentiality: This email and its attachments are intended for the
above named only and may be confidential. If they have come to you in
error you must take no action based on them, nor must you copy or show
them to anyone; please reply to this email and highlight the error.

************* [ www.eversheds.com <http://www.eversheds.com/>  ]
************* 

-------------------------------------------------------------------
OzMOSS.com - to unsubscribe from this list, send a message back to the
list with 'unsubscribe' as the subject.
Powered by mailenable.com 

-------------------------------------------------------------------
OzMOSS.com - to unsubscribe from this list, send a message back to the
list with 'unsubscribe' as the subject.
Powered by mailenable.com 

-------------------------------------------------------------------
OzMOSS.com - to unsubscribe from this list, send a message back to the
list with 'unsubscribe' as the subject.
Powered by mailenable.com 

-------------------------------------------------------------------
OzMOSS.com - to unsubscribe from this list, send a message back to the
list with 'unsubscribe' as the subject.
Powered by mailenable.com 

-------------------------------------------------------------------
OzMOSS.com - to unsubscribe from this list, send a message back to the
list with 'unsubscribe' as the subject.
Powered by mailenable.com 




------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.

Powered by mailenable.com

<<image001.jpg>>

Reply via email to