Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

Aptiva Dave

@Aptiva Dave
About
Posts
141
Topics
78
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Canceling or Terminating a workflow
    A Aptiva Dave

    I've built a custom workflow for SharePoint 2010 and would like to end the workflow at certain points based on values entered into the list item. I had originally used a codeActivity object that contained the following code:

    SPWorkflowManager.CancelWorkflow(workflowProperties.Workflow)

    However, with just that line of code, the workflow will still run until it gets to the end. So, I ended up adding this line of code:

    Throw New Exception("Ending Workflow")

    This stops the workflow, but I'm not cool with using an exception to end a workflow when no actual exception was thrown. I've looked up on the web about ending workflows and there were a few posts that had you set the tasks in the workflow as completed. However, in this workflow I don't actually assign tasks, so there isn't any tasks to complete. Does anyone have any suggestions I could try?

    SharePoint sharepoint question workspace

  • Some trouble with creating a group on feature activation
    A Aptiva Dave

    I've built a feature for our training department, which up until today has worked as intended. Today wrote some code in the feature activation that will add a new SharePoint group called 'Travel Plaza Managers' (Travel Plaza is a department within our organization that runs our gas stations). On the feature activation I first run a function called 'checkForGroup', which checks to see if the group has already been created on the site. Here is the code for that group:

    ''' ''' Checks to see if the group exists in the the site
    '''
    '''
    '''
    '''
    Public Function checkForGroup(ByVal groupName As String, ByVal web As SPWeb) As Boolean
    Dim group As SPGroup = Nothing
    Try
    group = web.Groups(groupName)
    Catch ex As Exception

        End Try
    
        If Not group Is Nothing Then
            Return True
        Else
            Return False
        End If
    End Function
    

    If this function returns 'False' then I call another function called 'CreateTPManagersGroup', which runs this code:

    ''' ''' Creates the Travel Plaza Managers Group
    '''
    ''' The current web
    '''
    Public Sub CreateTPManagersGroup(ByVal web As SPWeb)
    'create the owner of the group
    Dim owner As SPUser = web.SiteAdministrators("username")
    Dim member As SPMember = web.SiteAdministrators("username")
    'get the groups
    Dim groups As SPGroupCollection = web.SiteGroups
    'add the Travel Plaza Managers to the list of site groups
    groups.Add("TP Managers", member, owner, "These are the current Travel Plaza Managers of the Choctaw Nation")
    Dim newSPGroup As SPGroup = groups("TP Managers")
    Dim role As SPRoleDefinition = web.RoleDefinitions("Read")
    Dim roleAssignment As SPRoleAssignment = New SPRoleAssignment(newSPGroup)
    roleAssignment.RoleDefinitionBindings.Add(role)
    web.Update()
    End Sub

    So, the first time I ran this, the activation ran fine, but when I went to see if the group had been created the group name wasn't there. Figured I may have done something like not actually deploy the current version of the feature, so I did another deploy from Visual Studio and got the message saying that the group name had already been used. Did a debug on th

    SharePoint announcement csharp sharepoint visual-studio debugging

  • Propagating changes to a list and InfoPath form to all site pages in a Project 2010 SharePoint site.
    A Aptiva Dave

    Here is a little bit more background info on what I am dealing with: My Project Management Lead is the Site Admin for our Project 2010 SharePoint Site, and he had added a new field to the Deliverables list on the home site of the project site. We currently create a new Project site page each time we add a new project to the site, and he is wanting the new field to be available on all of the Deliverables lists of the new site pages. He is also wanting to have that field show up on the existing site pages so that all currently running projects can have the new field. He has also edited the form in InfoPath and would also like to have that form on all of the new and current site pages.

    SharePoint sharepoint business

  • Can't retract farm solution
    A Aptiva Dave

    Just started happening on my front-end server, but when I go to retract a farm solution I'm getting a error stating that "The creation of this directory failed: C:\Windows\Temp\solution-[GUID]. Next to the Deployment status of the wsp package is "Error". Has anyone seen this before? Is it a permission error? The service account that I have for sharepoint is added as an admin to the box.

    SharePoint sysadmin sharepoint help question

  • Multiple versions of a document added on each update
    A Aptiva Dave

    I have a project that has a piece that uploads documents to a library in which versioning is turned on. Everytime I add a new document or update a document I get two versions per update call. Here is my code:

    'create the spfile item
    Dim twoXtwoFile As SPFile = twoXtwo.RootFolder.Files.Add(fileName, fileBytes, True)
    Dim twoXtwoItem As SPListItem = twoXtwoFile.Item
    twoXtwoItem(twoXtwos.Year) = year
    twoXtwoItem("Title") = fileName
    twoXtwoItem(twoXtwos.Executive) = New SPFieldLookupValue(CInt(Request.QueryString("ID")), execItem(Execs.LookupName).ToString)

            Try
                twoXtwoItem.Update()
            Catch ex As Exception
                'display an error message
                errorMessage.InnerText = "Sorry, but this file could not be added.  Please try again or contact the IT Department Help Desk."
            Finally
                web.Dispose()
            End Try
    

    The code runs fine, but when I go look at the version history of the document you can see where you have two versions that are the exact same. You really notice on the first upload where you have version 1.0, which is the file itself, and then version 2 that has the same file and the list column items added to it. All subsequent updates just contain two versions of the same update. The only thing I can think of here is that my code is updating the file first and then going back and adding the list values to the object. Am I right to think that and what can I do so that I only have one version per update/add?

    SharePoint help announcement question

  • Adding spfielduservalues to a list keeps failing
    A Aptiva Dave

    Got a list that will hold domain accounts so I can have access to their email addresses. I am using the following code to add them to the list:

    Dim exec As New SPFieldUserValue
    For Each entity As PickerEntity In sppeExecs.ResolvedEntities
    web.EnsureUser(entity.Key)
    exec = New SPFieldUserValue(web, Convert.ToInt32(entity.EntityData("SPUserID")), entity.Key)
    Next
    'now, get the list and create the item container
    Dim execList As SPList = web.Lists.TryGetList(ListName)
    If execList Is Nothing Then
    errorMessage.InnerText = "Sorry, but the Executive Director List could not be loaded. Please contact the IT Department Help Desk @ extension 2195."
    Exit Sub
    End If
    Dim execItem As SPListItem = execList.AddItem()

            'add the executive user object and set the active field to true
            execItem(Name) = exec
            execItem(Active) = True
    

    What happens is in the For Each loop at the beginning the exec variable isn't being loaded with a value. I've done this before and it has always worked, so I don't know what I must have forgotten to do.

    SharePoint docker help

  • Setting up versioning from Visual Studio
    A Aptiva Dave

    Creating a document library in Visual Studio and was wondering if you could setup the versioning there. That way, if I don't deploy the package I know that it is turned on the way I had intended it to be turned on.

    SharePoint csharp visual-studio workspace

  • Sharepoint 2010 User Fields
    A Aptiva Dave

    I have a couple of projects where a use a people picker to get users added to a list. In our current domain environment we have two domains: our main domain that is used for user login information and another domain that was created for our erp system that, in my own opinion, needs to go away but hasn't. The erp domain is an exact copy of or main domain except that the user names are different and none of the profiles contain a user's email address. What I would like to do is filter out that erp domain from the people pickers so that users don't select those accounts. Is there a way to do this?

    SharePoint sharepoint question workspace

  • Package not deploying new list
    A Aptiva Dave

    Update: I did another deploy of the package and this time it worked. Not sure what happened, but I'm good now.

    SharePoint sysadmin question announcement

  • Package not deploying new list
    A Aptiva Dave

    I've just created a new list for a wsp package that I have previously deployed to my production site. The new list shows up just fine on my development server, but doesn't on my production. I have retracted the solution, removed it, and then deployed the updated solution, but the list does not show up on my production site. I have some pages that I built with this update and the show up just fine and the list, along with it's content types, are in the feature and the package. I've rebooted the server to see if they would show up and they still haven't. Is there anything else I need to look at that could show me the answer?

    SharePoint sysadmin question announcement

  • Resetting drop downs inside of a div
    A Aptiva Dave

    I know that there is an easy way to do this, but I'm so green on javascript programming that I'm missing something. Anyway, I have a div with some selects in it and I want to reset them all back to the first option. Here is my current code:

    $("#newAuction").children('select').each(function () {
    $(this).find('option:first').attr('selected', 'selected');
    });

    This isn't looping through all of the selects (there are four in this div) and resetting them to the first option. What am I doing wrong?

    JavaScript javascript question

  • Updating a content type with new column, but need to add the default value to existing items
    A Aptiva Dave

    yeah, all new items do, but I'm talking about items that were in the list before the new column was added

    SharePoint question

  • Updating a content type with new column, but need to add the default value to existing items
    A Aptiva Dave

    I have a content type that I am needing to add a new column to. This new column is a boolean field and by default it is set to False. Now, I already have alot of items in the existing list, so each of these will need to be updated as well with the default value of the field, but how would I do that? Do I do that in the Event Receiver of the Feature object? And under which method would I do that under: FeatureActivated or FeatureUpgrading?

    SharePoint question

  • Populating list columns in Sharepoint 2010 custom doc library
    A Aptiva Dave

    Ran into an issue just now and need a little help. I have a custom document library that has two columns for text: Title and VideoLink. This document library is for our HR department to upload training documents to our intranet along with optional videos that they will link from other sites. I can get the documents to upload fine, but nothing is populating in my two text columns. Without displaying my full code, here is basically what I'm doing for both columns:

    dim eItem as splistItem = elist.AddItem()
    ...
    eItem("Title") = txtDocItem.Text.Trim
    eItem("VidLink") = txtVidLink.Text.Trim
    eItem.Update()

    Is there something I'm missing? I've used the same logic to upload pictures to a picture library, and those custom fields work fine.

    SharePoint help sharepoint question announcement

  • Throwing an exception when trying to attach a document to a list item
    A Aptiva Dave

    I could never get the SPSecurity.RunWithElevatedPrivileges to work correctly when using webmethods. Have you tried this:

    //first, set the site to allow unsafe updates

    {
    SPWeb web = SPContext.Current.Web;
    web.AllowUnsafeUpdates = true;
    }

    SharePoint database question

  • Deleting Items in a SPListItemCollection
    A Aptiva Dave

    Been having some trouble with doing this and have looked all over the internet for the actual solution. At first I was using a for each loop and deleting individual spitem objects, but that doesn't work since the enumeration changes after each deletion. So, I found a blog post about deleting using the ProcessBatchData method. Here is my code:

    Dim sbDelete As StringBuilder = New StringBuilder
    Dim xmlFormat As String = "<?xml version=""1.0"" encoding=""UTF-8""?>"
    sbDelete.Append(xmlFormat)
    sbDelete.Append("<Batch>")
    Dim buildQuery As String = "<Method><SetList Scope=""Request"">" & fList.ID.ToString & "</SetList>"
    buildQuery = buildQuery & _
    "<SetVar Name=""ID"">{0}</SetVar Name=""Cmd"">Delete</SetVar></Method>"
    For Each x As SPListItem In flItems
    sbDelete.Append(String.Format(buildQuery, x.ID.ToString()))
    Next
    sbDelete.Append("</Batch>")
    web.ProcessBatchData(sbDelete.ToString)

    This runs fine, but when I go to the list where the items where supposed to be deleted from I find that they are still there. This web app is a fuel log for our Flight Operations department. What I'm trying to do is when the Admins delete a plane from the system, SharePoint would then deleted all of the fuel log entries for that plane. I figured it would be simple to do, but either I'm doing something wrong or it isn't as simple as I think.

    SharePoint sharepoint xml question announcement

  • Debugging question
    A Aptiva Dave

    Actually found the resolution and forgot to post it here. Anyway, it was the loopback check issue. It's a known issue from Microsoft, but apparently there is an update that has gone out and set a loopback check in the registry, which made the server keep checking the credentials whenever you tried logging into a site on it. I'll try to find the actual registry fix and post it here, but if you Google loopback check you should find the fix as well.

    SharePoint debugging question

  • Debugging question
    A Aptiva Dave

    Okay, I'm trying to debug a site and i can't log into it. Everytime I press F5 and let the debugger run I can't log into the site. Now, I can log into the site any other time, but I just can't when I'm debugging. Any ideas why?

    SharePoint debugging question

  • Very strange issue
    A Aptiva Dave

    Dang! Looked over that code a hundred times and didn't see that! Thanks!

    SharePoint help database question

  • Very strange issue
    A Aptiva Dave

    I did check for null and also put something into the list that flItems is getting objects from. I'm not sure what is going on, but on top of everything I can't log into the site when I try to debug on the dev server.

    SharePoint help database question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups