Set a default FilterField FilterValue to a custom SPView programmatically

Hi ,
I have create a custom SPView in order to assign it to my XsltListViewWebPart.
But i need to reproduce or set programmatically a FilterField / FilterValue.
I dont need CAML Query because my user need to change the filter's column as he pleases. If i use a CAML query, my pool of records will be limited. And i need a visual filter only.
Is there a solution to reproduce this mecanism ?
Regards.
Gilles.

SPSite oSite = new SPSite([Site URL]);// [Site URL] change it to your sharepoint site URL
SPWeb oWeb = oSite.OpenWeb();
SPList oList = oWeb.Lists["your list"];
SPViewCollection oViewCollection = oList.Views;
string strViewName = "MyCustomView";
System.Collections.Specialized.StringCollection viewFields =
new System.Collections.Specialized.StringCollection();
//The fields that you want on the view
viewFields.Add("Name");
viewFields.Add("Type");
string query = "<Where><Eq><FieldRef Name=\"Name\"/>" +
"<Value Type=\"Text\">yourValue</Value></Eq></Where>";// here you can filter your items using the selected
item in the dropdownlist
oViewCollection.Add(strViewName, viewFields, query, 100, true, false);
oWeb.Update();
http://social.technet.microsoft.com/Forums/sharepoint/en-US/09d61ce9-b659-4aa0-bbe9-00986cf5b6f2/creating-a-view-for-a-splist-using-a-column-filter-programmatically
http://www.dotnetspark.com/kb/5662-programmatically--apply-filter-to-sharepoint.aspx
http://blogs.msdn.com/b/sowmyancs/archive/2008/03/15/programmatically-create-a-view-custom-view-of-a-list-and-change-the-view.aspx

Similar Messages

  • Default customer type not set by default

    hello,
    we are having and issue with the "customer type" not being set by default.
    When a new customer is created (when they make a purchase) I would like them to be set as “Retail Customer” as their customer type .
    I have set the default customer type to be “retail customer” however this is not applied to the customer.
    has anyone else struck this problem?  is there a fix for this?
    thanks in advance for the help.

    This is as expected/normal behaviour.
    If you create a column in a list that already has items it will not automatically set that column to the default option. Instead any pre-existing items will have a blank value until/unless the item is next edited. At that point you can chose a value but
    it still will not populate with the default value.
    That is deliberate as it may be entirely valid to have blank entries and so overwriting those would be much worse than leaving entries blank.

  • Setting the default style sheet

    I am trying to set the default style sheet to my customized css - mainstyle19-en.css. I know that I have to run this command - ant make_main_css -DCOLOR=19 but I don't have ant in my path and it is not recognizing it as a command. How do you put that in the path? Also - where are you supposed to run this command? I know somewhere on the server where the image server is located, but where exactly?
    Thanks for your help,
    Karen.

    In addition, if you are using .net, Sarah Wheeler created a simple portlet that allows the user to create a header portlet with the ability to change the stylesheet. I have modified it a little and would be happy to share my version. Take a look at this thread - http://portal.plumtree.com/portal/server.pt/gateway/PTARGS_0_283309_4352_2758_4823_43/http;/PRODGADGET12.plumtree.com/collab/discussion/app/threadDetails.jsp?projID=39883&forumID=48674&threadID=80810&messageID=80894 (If the link doesn't work, it is located Discussions: Pluggable Nav, Style Sheet Mill, PEI, UI Cust: Changing colors/style sheets with custom header portlets?)
    If you send me an email at [email protected] will send you the code.
    Michael [email protected]

  • Setting Default values for field using custom.pll

    Hi All,
    I have an rquirement to set the default values on Meterial Tranasction screen for some condition
    I tried it in both ways via Form Personalization and using custom.pll
    i m using the following code in custom.pll
    form_name      varchar2(30):= name_in('system.current_form');
    block_name varchar2(30):= name_in('system.cursor_block');
    trx_type           varchar2(30);
    subinv                varchar2(30);
    begin
    if form_name='WIPTXMAT' and block_name ='MTL_TRX_LINE' then
    if event_name ='WHEN-VALIDATE-RECORD' then
         trx_type:=name_in('WIPTXMAT.TRANSACTION_TYPE');
    if trx_type ='WIP Return' THEN
         copy(10,'MTL_TRX_LINE.TRANSACTION_QUANTITY');
              copy(10,'MTL_TRX_LINE.NUMBER_OF_LOTS_ENTERED');
              sinv:=trim(name_in('MTL_TRX_LINE.SUBINVENTORY_CODE'));
              if sinv is null then
                   copy(subinv,'MTL_TRX_LINE.SUBINVENTORY_CODE');
                   copy(fr_locator,'MTL_TRX_LINE.LOCATOR');
                   FND_MESSAGE.SET_STRING(sinv);
                   FND_MESSAGE.SHOW;
              end if;
         end if;
    end if;
    end if;
    end event;
    Problem is that default values are getting set but not for all rows . if there are 4 records then values are set for only first 2 rows and if there are 2 rows then defaults are set for 1st row only.
    Same behaviour happens when i do it via form personalization
    i couldn't understand the behaviour of WHILE-VALIDATE-RECORD event..
    Please provide some suggestion on it. its really urgent.
    Thanks in Advance
    Renu

    Works Now...

  • How to set a default date for a custom field of Date type in project server 2010.

    hi,
    can somebody help  me.
    How Can i set the default date for a custom field of date type in project server 2010 ?

    Dear Rohan,
    You can set default value to custom field thru Lookup table. Assign lookup table to custom field and set default value to some lookup value (Note: check the “Choose a value to use as a default when adding new item” checkbox).
    Regards,
    Avinash kumar | Blog:http://avigr8.wordpress.com | If you found this post helpful, please “Vote as Helpful”. If it answered your question, please “Mark as Answer”.

  • Setting a default initial value to a CHAR type field in a custom table

    Is it possible to set a default initial value to a field in a customer table(Ztable) that is not SPACE?  SAP sets the initial value to " " space for datatype CHAR.
    I am looking at creating a field in a table that would always default to 'X' on creation of a new row.
    Your response is appreciated..

    Hi,
    I believe this cannot be done..
    If you are inserting the row through a program then you can insert the field value to be 'X'.. If the value is not passed ..Then it will be blank..
    If you are using table maintenance then in the PAI ..you can insert values..
    Thanks,
    Naren

  • How can set custom advanced print setting to default?

    Hi
    I am using job automation program called enfocus switch and
    Every time it automatically print out  PDF file, i wanted it to be printed out with bleed mark and page information.
    As i go to advanced print setup, i can achieve this by set setting to custom setting that has checked bleed mark and page info.
    Is there any way to set custom setting as default so Evey time enfocus program print out PDF, it is printed out with bleed marks and page info.
    Thanks

    this is what i wanted it to be default. checked bleed marks & page information
    went to setting-adobePDF. coudn't find any thing related to bleedmark and page info.
    Hope this give you more detail thank you for your time.

  • How do I set the default welcome page for PUBLIC user

    gurus,
    i'm using -
    Oracle 9i Database
    Oracle 9ias Portal Release 2
    QUESTION => how do I set the default welcome page for the PUBLIC user.
    i did the following to achieve this -
    1. logged into portal
    2. clicked on builder
    3. clicked on administer tab
    4. selected PUBLIC user in the Portal User Profile portlet
    5. went to the preferences tab
    6. in the default home page selected a custom page group
    7. logged out of portal
    8. open a new browsere session
    9. type the portal URL and i get the login page ....??
    i'm unable to understand this behavior ... shouldn't i be getting the page group that i set for the PUBLIC user in step 6 above ....
    the second QUESTION is => when the user logs out he/she should see the PUBLIC page set in step 6 above ... but, instead the user sees a page that is as follows -
    Partner Application Name Logout Status [Logout Status]
    Oracle Portal (portal) logout status
    The SSO Server (orasso) checkmark
    buzz.resva.trw.com:7778 checkmark
    infrastructure.happy.resva.trw.com checkmark
    portal1.buzz.resva.trw.com checkmark
    portal2.sylvester.resva.trw.com checkmark
    sylvester.resva.trw.com:7778 checkmark
    so, how can i set the default page for the PUBLIC user and also a page when he user logs out.
    ideas anyone ....?
    thanx a bunch.
    hero

    Hi,
    The sequence of operation you are doing to set the home page for public users is correct. You are getting the login screen as the "custom page group" selected as "home page" has not been granted to public.
    Also, while logging-out, it is normal behaviour to get the screen where it shows the list of partner applications from where user has been logged-out. When you click on "Return" button, you will get to the "home page" set above.
    Hope it clarifies the things.
    Regards,
    Ved

  • How do I set the default Hero image in a Muse slideshow widget when using Free Form Thumbnails?

    Hello,
    I am trying to find out how to set the default Hero image when using a Muse slideshow widget and in the Layout section I have the "Free Form Thumbnails"
    box checked.
    In other words, when the page loads I want to define which image displays as the first Hero image.
    If I do not select the "Free Form Thumbnails" option, the top left Thumbnail image always displays first. This is fine.
    But when I select the Free Form Thumbnails" checkbox I don't know how to define which image shows first as the Hero image.
    I have a short video at this link where I illustrate the question:
    http://amson.org/misc/default-hero-image-1.mp4
    I have added a WMV video file at the link below:
    http://amson.org/misc/default-hero-image-1.wmv
    Okay… I think I've worked out how to do it!
    [1] First have the "Free Form Thumbnails" box UNCHECKED.
    [2] Organize the Thumbnails and place the image that you want to be the first Hero image when the page loads in the top left corner of the Thumbnails group.
    [3] When you "Preview Site In Browser" the Thumbnail image in the top left corner will always display as the first Hero image.
    [4] If you want "Free Form Thumbnails" go ahead now and SELECT that checkbox.
    [5] Whichever image was in the top left of the Thumbnail group before you checked "Free Form Thumbnails" will still show up as the first Hero image when the page loads, regardless of where that thumbnail image is located within the Thumbnail images group.
    Thanks very much.
    Chris.

    Hi,
    The sequence of operation you are doing to set the home page for public users is correct. You are getting the login screen as the "custom page group" selected as "home page" has not been granted to public.
    Also, while logging-out, it is normal behaviour to get the screen where it shows the list of partner applications from where user has been logged-out. When you click on "Return" button, you will get to the "home page" set above.
    Hope it clarifies the things.
    Regards,
    Ved

  • Is there a way to set a default "Source Range" in AME when exporting from Premiere Pro CC?

    When exporting a sequence from Premiere Pro CC, you are able to toggle between 4 drop down options within Adobe Media Encoder on what Source Range you'd like to export (Work Area, Sequence In/Out, Entire Sequence, Custom) as seen here:
    Is there a way to set the default Source Range to something besides Sequence In/Out?
    My reason for asking is that sometimes I export multiple sequences at once using AME's Queue. I add my custom presets to each Sequence and hit export, but SOMETIMES I may have accidentally marked an in point on my timeline and by default it's set to export only that In-to-Out part of the sequence.
    I know what you may be thinking...well, just don't add any In/Out points to your sequence on the timeline or clear them first. The trouble is that I often don't see them or catch them when working quickly. In Premiere Pro CC, I use the "Lighter Brightness" Appearance setting because it's easier on my eyes after editing 10 hours a day, 6 days a week. Sure, darker looks cooler, but it kills my eyes for some reason. Anyway, PPro CC has a troublesome appearance issue in CC where it's not "optimized" for editing when you change it to a lighter appearance like it was in CS6. I've already contacted Adobe about this and another appearance issue (involving highlighted clips when in Lighter Appearance setting) and they are "actively working on fixing this appearance issue asap". 
    For reference, here's Premiere Pro CC in/out points in default dark appearance (notice the slightly lighter grey area):
    Now here's that same in/out in "Lighter Appearance":
    Not exactly optimized. Can hardly see it. Good luck spotting that little guy on a long timeline. Sadly, this affects in/out points in the Source Window as well. Really hard to see.
    Conversly, CS6 looked the best (the blue REALLY stands out making things easy to see):
    So my question again...is there a way to set the default "Source Range" to something else besides Sequence In/Out so that I don't end up doing what I just did and leaving for several hours while batch exporting only to come back and find that I exported only a "portion" of one of my big sequences?
    Thank you!

    shooternz wrote:
    Here is the solution:  Slow down. Give your project some love. Smell the roses.
    Agreed about the roses but alas my next project always calls. Actually, I think what happens is I give each project SO much love that when it comes to exporting, I've run out of time.
    shooternz wrote:
    Then it would not be a default...it would be an option and you already have that option.
    Semantics aside, I would love to be able to have it at least default to whatever option was last chosen. Or, perhaps I shouldn't use the word default again...I'd love it to simply remember my preferred setting. That's all.

  • How can I set a 'default' watermark to appear on all my photos?

    I've started processing photos on my husband's computer, using his LR.  He passed away recently.  I've created a number of new catalogs, with probably 1000 photos.
    I just emailed some to family, and discovered that his watermark/copyright is on my pictures, which is not a good thing since he passed away.  
    What I would like to do is:
    1.  Change the watermark on those 1000 or so of my photos that are contained within 8 catalogs
    2.  Set up a default so that my watermark appears on all future photos.
    I've gone through the Watermark Editor and made my own custom setting, which shows in the list of custom settings.  My watermark then appears on the photo in the preview within the Watermark Editor window.  I hit 'done' and export the photo to my desktop, but my husband's watermark still appears on it.
    I've fiddled with this for a couple of hours and then looked for help online.  That's how I found your forum.
    Thank you for any assistance.
    Kim

    G'day 5508,
    Some thoughts. Try System settings first (this may not be the culprit).
    System Preferences > Language and Region > Advanced > Currency > Australian Dollar
    I can only adjust the currency cell by cell, column by column page by page.
    Forgive my stupidity, but if the currency is a cell format in the template, can you select all currency cells at once, then change the currency? You will have to do this separately for each Table, but within a Table, you can select a range of cells. Quicker than cell by cell.
    Once you have reformatted the document that emerged from that template, save the document as a template with the same name to overwrite the old template.
    Hope this helps, mate.
    Regards,
    Ian.

  • How can I set the default home page for all new users in Firefox 4

    I'm trying to deploy FF 4.0rc1 in a corporate environment but I can't find a way to set the default home page or any other settings for that matter.
    Is there a way to set the default home page for all new users and lock it so that the users can't change home page?
    Best regards
    Jonas

    In Firefox 4 the template folder for new profiles (C:\Program Files\Mozilla Firefox\defaults\profile\
    ) doesn't exist. You can create that \defaults\profile\ folder and place a file user.js in it with the prefs that you want to initialize.
    See:
    *http://www-archive.mozilla.org/catalog/end-user/customizing/briefprefs.html
    You can also use a mozilla.cfg file to set the default value for prefs.<br />
    See: http://kb.mozillazine.org/Locking_preferences
    defaultPref(); // set new default value
    pref(); // set pref, but allow changes
    lockPref(); // lock pref, disallow changes

  • Is it possible to set a default mfg_organization_id for a responsibility?

    We have a responsibility that only has access to 1 inventory organization as defined by Organization Access. Our users think it is silly that they should have to do a Change Org when there is only one responsibility to choose from. Is there any way to set a default profile value for the mfg_organization_id at the responsibility level?
    thanks,
    Ken

    We do have a partial work-around for the problem I described. We have added the following parameters to the menu function used to get to the run concurrent requests form.
    REQUEST_GROUP_CODE="<our custom request group code>"REQUEST_GROUP_APPL_SHORT_NAME="<out custom application short name>"USE_ORG="Y"
    This causes the mfg_organization_id to be set. But this is only a partial solution since there are other ways of running a concurrent request. For example, View > Requests > Submit a New Request.

  • Wrong default layout for a new customer

    Hi all,
    I hope somebody can share inputs with regards to this issue.
    I'm assigning a default layout to one customer group (layout1 for all Group1).  When this was done, a list of customer codes were included in the list and each were ticked from that list.
    Second layout called layout2 for the setting 'Set &as Default for all BPs (for Whom a Default Layout Has Not Been Assigned).
    Scenario:  A new customer code is created belonging to Group1.
    Issues: 
                a.  This new customer code does not automatically follow the setting on default layout which is layout1.  When the layout1 default setting was double  
                     checked, the new customer code was part of the list, but it was not ticked. 
                b.  When document was previewed, it uses the wrong layout2.
                c.   The user still has to update the layout1 default setting, ticking the tick box from the list for the new customer code, then clicking update in then
                      layout designer window.
    Question:  Is this a normal behaviour of the system?  I thought that setting it as default for certain customer group will be applicable even to newly created ones under that group.
    Regards,
    Cathy

    Hi,
    I am afraid that it is your SAP B1 version current behavior but you may check using demo database. What is your SAP B1 version anyway ? what is your database localization ?
    You may try the solution part from one of these notes below:
    993486  - 'Set as Default for All BPs' doesn't affect specific BP
    Version   5   Validity: 21.01.2011 - active
    Language   English (Master)
    Portuguese 
    Content:      Summary    |    Header Data    |    References    |    Validity 
    Symptom
    Specific printing template for Business Partner can not be changed in attempt to define printing template as a default template for all Business Partners.
      Cause
    Functionality description
      Solution
    In order to change a specific default printing template for Business Partner follow the steps below:
    1. Choose the required template and press on the 'Set as Default' button.
    2. Choose the 'Set as Default for Specified BP' and 'Set as Default for Current User' option.
    3. Uncheck the box near the BP name and press on the 'Update' button.
    4. Choose the required default template (new template) and press on the 'Set as Default' button.
    5. Choose the 'Set as Default for all BP' option.
      Other terms
    Print Layout Designer, Default Template, Set as Default for All Users,
    Set as Default for Current User, Set as Default for All BPs, Set as Default for Specific BP
            Header Data
    Released On
    24.02.2011 20:52:30   
    Release Status
    Released for Customer   
    Component
    SBO-GEN-PLD Print Layout Designer  
    Other Components
    SBO-SH-PLD-A2 Tips and tricks for building PLD templates
    Priority
      Recommendations/additional info   
    Category
      Consulting   
           References
    This document refers to:  SAP Business One Notes
    861088
    Cannot set a template as default for all users
    This document is referenced by:   SAP Business One Notes (1) 
      861088
      Cannot set a template as default for all users
           Validity
    Software Component
    Version
    SAP BUSINESS ONE
    2005 A
    2005 A SP01
    2005 B
    2007 A
    2007 B
    8.8
    2nd note:
      861088  - Cannot set a template as default for all users
    Version   4   Validity: 04.08.2009 - active
    Language   English 
    Content:      Summary    |    Header Data    |    References    |    Validity 
    Symptom
    When print previewing,the template used is not default template.
      Cause
    A template has been defined as default for all users, when previewing this it is not the template which has been set as default for document.
      Solution
    In order to change to a different default template for all users and all business partners please do the following:
    a) "Set as default for specified Business Partner" and "set as default for current user"
    b) Add tick for this Business Partner
    c) Update by ticking again the specific Business Partner
    d) Change set as default for all users and all Business Partner's
      Other terms
    Print Layout Designer, Default Template, All users, Set as Default template, SAP Business One
            Header Data
    Released On
    04.08.2009 11:28:58   
    Release Status
    Released for Customer   
    Component
    SBO-GEN-PLD Print Layout Designer  
    Other Components
    SBO-SH-PLD-A1 Print Layout Designer known Issues
    Priority
      Recommendations/additional info   
    Category
      Consulting   
           References
    This document refers to:  SAP Business One Notes
    993486
    'Set as Default for All BPs' doesn't affect specific BP
    This document is referenced by:   SAP Business One Notes (1) 
      993486
      'Set as Default for All BPs' doesn't affect specific BP
           Validity
    Software Component
    Version
    SAP BUSINESS ONE
    2004 A
    2005 A
    2005 A SP01
    2005 B
    2007 A
    2007 B
    JM

  • Setting a default folder view for all folders in Windows 7

    How do you set up a default folder view of "List" for ALL the folders in Windows 7 including the optical drive?  
    Artoo

    I just installed windows 7. Are you seriously telling me that i now have all folders with mp3s in them AUTOMAGICALLY (THANKS FOR THE HANDY HELPING HAND THERE MICROSOFT!!!) set to some designers whim of what an mp3 folder "SHOULD" look like?
    Well i was going to write a big rant, and indeed did, but then i was doing some more research and it seems like i just made everyones day and solved the problem (partially). Or well THIS guy did:
    http://www.howtogeek.com/howto/16694/customize-the-five-windows-folder-templates/
    After you’ve clicked OK, visit some of the other folders in your file system.  You should see that most have taken on these new settings.
    What we’ve just done, in effect, is we have customized the General Items template.  This is one of five templates that Windows Explorer uses to display folder contents.  The five templates are called (in Windows 7):
    General Items
    Documents
    Pictures
    Music
    Videos
    When a folder is opened, Windows Explorer examines the contents to see if it can automatically determine which folder template to use to display the folder contents.  If it is not obvious that the folder contents falls into any of the last four templates,
    then Windows Explorer chooses the General Items template.  That’s why most of the folders in your file system are shown using the General Items
    template.
    Changing the Other Four Templates
    If you want to adjust the other four templates, the process is very similar to what we’ve just done.  If you wanted to change the “Music” template, for example, the steps would be as follows:
    Select a folder that contains music items
    Apply the existing Music template to the folder (even if it doesn’t look like you want it to)
    Customize the folder to your personal preferences
    Apply the new template to all “Music” folders
    A fifth step would be:  When you open a folder that contains music items but is not automatically displayed using the Music template, you manually select the Music template for that folder.
    Anyways, sorry that explanation doesnt do it justice. I have spent waaay too much time trying to figure this out already. Also that link doesnt say how to 1) copy templates (are they file or registry based?, didnt do research) 2) if you can distable templates
    or the automatic re-templating of folders.
    THAT is what i want to know! as it is much more maintance then its actually worth...
    but once i had set 5 default types to, the exact same thing... it now doesnt matter if it automagically switches it. SUCK IT MS AUTOTUNE!!!
    Its bloody hard to frame this question too. What can you say about this? "folder changes to mp3" "customize folder types windows 7" "windows 7 folder changes to mp3" "dont automatically change folders to mp3" "how
    to change mp3 details column for good" "automatically change column order win 7 mp3"
    The search that actually solved it:
    "do not apply default template to mp3 windows 7"
    good luck, this worked for me!
    EDIT: also i just noticed that neonr already answered this above. i just didnt read it carefully enough. anyways i guess i will leave this and mark his as answer.

Maybe you are looking for