I've got some code that loops through webparts on a page looking for an Advanced Search box in order to change some properties. Very simple stuff, essentially:
if (webpart is AdvancedSearchBox) {
do stuff;
}
I have seen this class referenced on blogs in code pertaining to SharePoint 2010 (http://weblogs.asp.net/spano/archive/2012/07/20/customizing-a-sharepoint-2010-search-center.aspx for example), but I can't for the life of me find the class itself. The only official reference I can find refers to 2007 - http://msdn.microsoft.com/en-us/library/microsoft.office.server.search.webcontrols.advancedsearchbox(v=office.12).aspx, and no matter what assemblies I include, Intellisense just does not recognise it.
I hope I'm missing something obvious - does anyone know where this class is, or whether it's deprecated? The web part itself is already in use in our solution, so it definitely exists somewhere.
Many thanks in advance!
Solved it. What was needed in order to use the class was all of the following:
Microsoft.office.server.search.dll added as reference
Both of the following using directives:
using Microsoft.Office.Server.Search
using Microsoft.Office.Server.Search.WebControls
And a Visual Studio restart
I think it was the last point that stumped me - until the restart, VS wasn't recognising the class name at all.
With thanks to Pradip T on Technet. http://social.technet.microsoft.com/Forums/sharepoint/en-US/295b0962-0cdf-41e4-96c9-d07876982c4d/sharepoint-2010-advancedsearchbox-class-or-similar
Related
I am creating a series of window mockup templates based on the excellent Mockups library available on CodePlex.
I'm using their BaseMockup as the base for my control as well, and I followed the same outline of the steps listed here for sub-deriving from existing controls (Create a new empty class, add your default style to /Themes/generic.xaml, etc.)
The control is working great - the only thing is that it doesn't show up in the Assets library. I think this is because it's sub-derived, or because I need some attribute (the equivalent of the ToolboxItemAttribute for WinForms controls? ... which didn't work) to get it hooked up.
When I modify the code to derive directly from Control, it shows up - no custom attribute necessary. Of course that defeats the purpose of what I'm trying to do though...
The only thing I can find are several articles telling me to muck with registry keys, and none of them are clear or suggest a definitive way to do this with Blend 4. That last one advertises as a Blend 4 tips article, but admits at the end that it plagiarizes the content from the other two (for Blend 3).
Is that my only option - register my DLL? Is there a better way to do this?
A while ago I wrote a blogpost about this. I've included a .reg file and a .bat file for setting up the register and some directories. I think that's what you are looking for.
I believe you do need to muck with registry keys. Specifically,
32 bit: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NET Framework\v4.0.30319\AssemblyFoldersEx
64 bit: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NET Framework\v4.0.30319\AssemblyFoldersEx
Create a new key with the name of your control assembly. Then edit the Default string value under this key and set the value to the directory where the control assemblies are installed. See here for a full example (using the Silverlight paths).
Found it - there is an analogue attribute after all, it's ToolboxBrowsableAttribute.
You have to go through a little more rigmarole to get it set up, but it works great - no registry mucking necessary. It requires creating a designer metadata provider class, attributing your assembly so it's designer-discoverable, and then adding the attributes to your sub-derived controls inside your metadata provider.
Make sure you choose the appropriate version of the page for your version of Visual Studio, because the interface changes a good bit between 2008 and 2010.
This article on CodeProject has some good, real-world examples of setting this up. They're all in the 2008 style though, so bear that in mind if you're using 2010.
I noticed that sitecore has the option of exporting users in an Excel format.
I need to have similar functionality for exporting 'participations', (a users can enlist to take part in an 'event', and if their entry is approved via a sitecore workflow, a 'participation' item is created in the content tree)
Since mostly everything in Sitecore is in essence based on items, and I want to export items to Excel, my question is - what are some of the best ways of doing this?
Questions:
Is there a way to re-use this functionality for regular items?
Would it be a good idea to create a custom admin page (any tips on doing this?) which has some custom code that reads the items from the database using the API?
are there sitecore plugins/shared source projects that can help me achieve this?
Or does anyone have a better idea? - would it be better to just store the participations in SQL? I'm mostly doing it this way because I want to make use of the 'free' functionality offers, for example workflow, but if that leads to me using anti-patterns please shoot me ;)
Link is different now: https://marketplace.sitecore.net/en/Modules/Advanced_System_Reporter.aspx
P.S. Couldn't leave a comment to original answer as I don't have enough reputation. Oh well :)
Found a most excellent shared source module which does exactly this (and much more)!
Basically it allows you to configure (and easily extend, if you need to) any kind of table based report on 'items'.
The report module shows up as an application in the sitecore menu (like the user manager tool) and comes with features such as xml,csv, xls export. It's also really easy to set up, once you get the hang of it.
http://trac.sitecore.net/AdvancedSystemReporter
One of the coolest features I've seen in help viewers is the ability to hide inherited members so you can focus on only what that particular subclass offers. A good example of this is here...
http://james.newtonking.com/projects/json/help/html/T_Newtonsoft_Json_JsonConvert.htm
Actually, that page has various options for how to show the help, not just hiding inherited members.
Now online MSDN has a habit of just throwing everything under the sun at you meaning trying to figure out what a subclass has added, let alone getting to it requires tons of scanning and even more scrolling.
That said, is there any way, local or online, to enable those or similar features? Has anyone made an external or third-party help viewer that does this or something similar?
(Note: I'm not really sure if this is for SO since it's not a programming thing, but it is sort of an IDE-related thing so I figured I'd gamble and put it here.)
Mark
Hiding inherited items is one thing I used to miss in the Lightweight style online MSDN docs.
Fortunately, it can be easily solved by using a litte bit of in browser javascript. See How to hide inherited members on MSDN pages for details.
You should be able to expand the used principle to hide any information you need (eg. you could use the icons to tell apart the static members, methods, properties and so on...).
Updated answer for 2016:
Create a bookmark in a modern browser with the following javascript snippet as the URL:
javascript:var trs=document.getElementsByTagName('tr');var l=trs.length;for (var i=0; i<l; i++) { var tr=trs[i]; if (tr.innerHTML.indexOf('(Inherited from ')>-1) tr.style.display=tr.style.display=='none'?'':'none'; }; void(0);
Clicking this bookmark while on an MSDN class documentation page will toggle all the inherited members on and off.
The javascript is just looking through all of the table rows ('tr') on the page, finding any which contain the string '(Inherited from ', and setting their display style (visibility) to 'none'. That search string seems to cover every instance of a member being inherited.
I'm not sure this is possible, but figured I´d give it a shot. First a few pre-requeistes and environment details:
I´m using SharePoint 2010, SharePoint
Designer 2010, VS 2010
I want to create as little code as
possible, preferably, create it all via UI or Designer
use out of the box components as much
as possible
Here is What I want to do:
Have a custom list with custom columns (easy part)
Create a webpart with an edit interface to select a single item from this list
This same webpart when visible would display the contents of this selected item in a given layout
I know I can do this creating a custom web part and code it all from scratch, I guess my main question is, is there a way to do this with less code and more out of the box components in SP2010. If not, I guess I'm left with lots of C# code.
Any tips, or pointers in this direction will be most welcome. Thanks in advance.
I think what you're looking for is the Data Form Web Part.
Unfortunately, I can't find any good tutorials for 2010, but hopefully the steps should be similar to setting it up in 2007.
Thanks all for the update. In the end, i had to create quite a bit of code to get this to work:
created a web part that enumerates
the content type,
creates a light box that has a picker
then stores the ID of the content in a column
Not the easiest way,but the only way I could get it working. Thanks again!
Im quite new to SHarepoint. I have a requirement like, i need to move some documents from different document libraries to a document library named "Region". So that each time a document is updated in these document libraries , the document should be updated in the library "Region" as well.
I wrote a c# function in a class library,to copy the documents to the library and added the dll to that sites Bin folder.Function is working fine. But Im stuck up , Im n ot sure where to call this function.In which event should i write it, so that each time any of these documents are modified, that change has to be reflected in the "Region" library .
You have to create a SharePoint event handler and attach it to all the document libraries where you change the documents. You will then override the ItemAdded and ItemUpdated methods to perform the copying.
See more info in this StackOverflow discussion: SharePoint running a method when item added to a library
Using an event handler is probably the best way to go as mentioned by naivists. Alternatively, if the work you are carrying out is part of a larger whole, e.g. a Workflow, then you may want to consider creating a Visual Studio Workflow, which may be quite complex to get started with, or use a simple tool like the Workflow Power Pack that allows simple C# snippets to be added directly to SharePoint Designer Workflows.
Have a look at these articles. More info can be found here.
Note that I worked on the Power Pack so I am biased. Having said that it works great ;-)